General updates & tidy-up #22
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 PR Preview | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| - closed | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: "pr-preview" | |
| cancel-in-progress: false | |
| jobs: | |
| deploy-preview: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.1' | |
| bundler-cache: true | |
| - name: Build with Jekyll | |
| run: bundle exec jekyll build | |
| env: | |
| JEKYLL_ENV: production | |
| - name: Deploy to gh-pages | |
| run: | | |
| # Switch to gh-pages branch | |
| git fetch origin gh-pages:gh-pages || git checkout --orphan gh-pages | |
| git checkout gh-pages | |
| # Clear and copy site | |
| rm -rf * 2>/dev/null || true | |
| cp -r _site/* ./ 2>/dev/null || true | |
| # Commit and push | |
| git add -A | |
| git config user.name "GitHub Actions" | |
| git config user.email "actions@github.com" | |
| git commit -m "Deploy preview from PR #${{ github.event.number }}" || exit 0 | |
| git push origin gh-pages | |