Update README.md #68
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: Build and Push to GitHub Pages Branch | |
on: | |
push: | |
branches: | |
- main | |
# Review gh actions docs if you want to further define triggers, paths, etc | |
# https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on | |
jobs: | |
deploy: | |
name: Deploy to GitHub Pages | |
runs-on: ubuntu-latest | |
env: | |
baseurl: "/wot-cg/tutorials/whatiswot/" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: npm | |
cache-dependency-path: Tutorials/whatiswot/website/package-lock.json | |
- name: Install dependencies | |
run: cd Tutorials/whatiswot/website && npm ci | |
- name: Build website | |
run: cd Tutorials/whatiswot/website && npm run build | |
- name: Stash possible yarn.lock changes | |
run: git stash | |
- name: Get branch information | |
run: git fetch | |
- name: Change to deployment branch | |
run: git checkout docusaurus-whatiswot | |
- name: Move build folder around | |
run: mkdir -p temp && cp -r Tutorials/whatiswot/website/build/* temp/ && rm -r Tutorials && mkdir -p tutorials/whatiswot && cp -r temp/* tutorials/whatiswot/ && rm -r temp | |
- name: Check for changes | |
continue-on-error: true | |
run: | | |
git diff --exit-code | |
echo "::set-output name=changed::$?" | |
id: diff | |
- name: Deploy to GitHub Pages | |
if: ${{ ! steps.diff.outputs.changed }} | |
run: | | |
git config user.name 'Ege Korkan' | |
git config user.email 'egekorkan@gmail.com' | |
git add . | |
git commit -s -m "push the build to github pages branch" | |
git push origin docusaurus-whatiswot |