Refactor preview deployment workflow: update permissions, streamline … #8
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: Build Preview for Testing | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| types: [opened, synchronize, reopened, closed] | |
| push: | |
| branches: | |
| - preview/* | |
| - staging | |
| # Recommended concurrency group for preview-pages action | |
| concurrency: | |
| group: preview-pages-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| jobs: | |
| build-preview: | |
| runs-on: ubuntu-latest | |
| if: github.event.action != 'closed' | |
| 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 for preview | |
| run: | | |
| bundle exec jekyll build --destination ./_site | |
| env: | |
| JEKYLL_ENV: production | |
| - name: Deploy Preview Pages | |
| uses: rajyan/preview-pages@v1 | |
| with: | |
| source-dir: ./_site | |
| configured-domain: devnomadic.com | |
| target-dir: preview | |
| pr-comment: sticky | |
| branch-comment: each |