Merge pull request #456 from jln-ho/bugfix/fix-typo-in-options-reference #67
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: website | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'www/docs/*.md' | |
- 'www/docs/web/*.md' | |
- 'www/website/*' | |
jobs: | |
build: | |
env: | |
WWW_TARGET_BRANCH: gh-pages | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
- name: Build webpage | |
run: | | |
npm ci | |
npm run build | |
working-directory: ./www/website | |
- name: Copy data | |
run: | | |
mkdir -p ${{env.HOME}}/tmp/www/build | |
cp -r ./www/website/build/ghz/. ${{env.HOME}}/tmp/www/build | |
- name: Check out target branch | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ env.WWW_TARGET_BRANCH }} | |
- name: Copy new data | |
run: | | |
cp -r ${{env.HOME}}/tmp/www/build/. . | |
- name: Commit to repository | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_PAGES_ACTION_TOKEN }} | |
COMMIT_MSG: Update website | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Bojan" | |
# Update origin with token | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
# Add changed files | |
git add . | |
# Only commit and push if we have changes | |
git diff --quiet && git diff --staged --quiet || (git commit -m "${COMMIT_MSG}"; git push origin ${WWW_TARGET_BRANCH}) |