Changed title #9
This file contains hidden or 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: Deploy Website to GitHub Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - create-cicd # Line added for testing. | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| ref: main | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Clear gh-pages branch | |
| run: | | |
| git worktree add ../gh-pages-worktree gh-pages | |
| rm -rf ../gh-pages-worktree/* | |
| - name: setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '23.9' | |
| - name: Install dependencies | |
| run: | | |
| cd ./website | |
| npm ci | |
| - name: Build website | |
| run: | | |
| cd ./website | |
| npm run build | |
| - name: Copy build files to gh-pages | |
| run: | | |
| cp -r ./website/build/* ../gh-pages-worktree/ | |
| - name: Push changes to gh-pages | |
| run: | | |
| cd ../gh-pages-worktree | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| git commit -m "Deploy website to GitHub Pages" || echo "No changes to commit" | |
| git push origin gh-pages || echo "No changes to push" |