|
| 1 | +# Sample workflow for building and deploying a Jekyll site to GitHub Pages |
| 2 | +name: Deploy Jekyll with GitHub Pages dependencies preinstalled |
| 3 | + |
| 4 | +on: |
| 5 | + # Runs on pushes targeting the default branch |
| 6 | + push: |
| 7 | + branches: ["main"] |
| 8 | + workflow_run: |
| 9 | + workflows: ["GitHub Pages - Generate XML sitemap"] |
| 10 | + types: |
| 11 | + - completed |
| 12 | + |
| 13 | + # Allows you to run this workflow manually from the Actions tab |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 17 | +permissions: |
| 18 | + contents: read |
| 19 | + pages: write |
| 20 | + id-token: write |
| 21 | + |
| 22 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 23 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 24 | +concurrency: |
| 25 | + group: "pages" |
| 26 | + cancel-in-progress: false |
| 27 | + |
| 28 | +jobs: |
| 29 | + # Build job |
| 30 | + build: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + concurrency: |
| 33 | + group: jekyll-gh-pages-${{ github.ref }} |
| 34 | + cancel-in-progress: false |
| 35 | + steps: |
| 36 | + - name: Harden the runner (Audit all outbound calls) |
| 37 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 38 | + with: |
| 39 | + egress-policy: audit |
| 40 | + |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 |
| 43 | + - name: Setup Pages |
| 44 | + uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 |
| 45 | + - name: Build with Jekyll |
| 46 | + uses: actions/jekyll-build-pages@44a6e6beabd48582f863aeeb6cb2151cc1716697 # v1.0.13 |
| 47 | + with: |
| 48 | + source: ./ |
| 49 | + destination: ./_site |
| 50 | + - name: Upload artifact |
| 51 | + uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 |
| 52 | + |
| 53 | + # Deployment job |
| 54 | + deploy: |
| 55 | + environment: |
| 56 | + name: github-pages |
| 57 | + url: ${{ steps.deployment.outputs.page_url }} |
| 58 | + runs-on: ubuntu-latest |
| 59 | + needs: build |
| 60 | + concurrency: |
| 61 | + group: jekyll-gh-pages-${{ github.ref }} |
| 62 | + cancel-in-progress: false |
| 63 | + steps: |
| 64 | + - name: Harden the runner (Audit all outbound calls) |
| 65 | + uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1 |
| 66 | + with: |
| 67 | + egress-policy: audit |
| 68 | + |
| 69 | + - name: Deploy to GitHub Pages |
| 70 | + id: deployment |
| 71 | + uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 |
0 commit comments