Skip to content

Commit

Permalink
Fix gh-pages workflow (master branch) (#2170)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcustyphoon authored Dec 2, 2024
1 parent bb16651 commit 43e5e17
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/gh-pages-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ on:
branches:
- 'master'
paths:
- 'Extensions/dist/'
- 'Extensions/dist/*'
workflow_dispatch:

permissions:
contents: write

jobs:
build:
Expand All @@ -25,4 +29,14 @@ jobs:
run: npm ci

- name: Update gh-pages
run: npx gh-pages --add --dist . --src "Extensions/dist/"
run: >
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npx gh-pages
-u "github-actions-bot <[email protected]>"
--add
--dist .
--src "Extensions/dist/"
--message 'Update Extensions/dist/'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 19 additions & 23 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,24 @@ on:
paths:
- 'Extensions/*'
- 'Themes/*'
workflow_dispatch:

permissions:
contents: write

jobs:
build:
name: Autobuild extensions
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v2.1.2
uses: actions/setup-node@v4
with:
node-version: 14

- name: Configure git
run: |
git config --global user.name "github-actions"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Fetch and reset gh-pages
run: |
git remote set-branches --add origin gh-pages
git fetch
git checkout -f -t -b gh-pages origin/gh-pages
git reset --hard 7.9.2
cache: npm

- name: Install dependencies
run: npm ci
Expand All @@ -47,10 +38,15 @@ jobs:
- name: Build distribution
run: gulp build

- name: Commit changes
run: |
git add --force Extensions/
git commit -m 'Rebuild Distribution'
- name: Force-push to gh-pages
run: git push -f
- name: Push changes to gh-pages
run: >
git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
npx gh-pages
-u "github-actions-bot <[email protected]>"
--add
--dist .
--src "{Extensions/dist/*.json,Extensions/dist/page/gallery.json,Extensions/dist/page/list.json,Extensions/dist/page/themes.json}"
--message 'Rebuild Distribution'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 43e5e17

Please sign in to comment.