|
| 1 | +# Sample workflow for building and deploying a Jekyll site to GitHub Pages |
| 2 | +name: Deploy Jekyll with GitHub Pages depename: "Build and Deploy" |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + paths-ignore: |
| 8 | + - .gitignore |
| 9 | + - README.md |
| 10 | + - LICENSE |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: read |
| 14 | + pages: write |
| 15 | + id-token: write |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: "pages" |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + build: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + |
| 25 | + steps: |
| 26 | + - name: Checkout |
| 27 | + uses: actions/checkout@v4 |
| 28 | + with: |
| 29 | + fetch-depth: 0 |
| 30 | + # submodules: true |
| 31 | + # If using the 'assets' git submodule from Chirpy Starter, uncomment above |
| 32 | + # (See: https://github.com/cotes2020/chirpy-starter/tree/main/assets) |
| 33 | + |
| 34 | + - name: Setup Pages |
| 35 | + id: pages |
| 36 | + uses: actions/configure-pages@v3 |
| 37 | + |
| 38 | + - name: Setup Ruby |
| 39 | + uses: ruby/setup-ruby@v1 |
| 40 | + with: |
| 41 | + ruby-version: 3.2 |
| 42 | + bundler-cache: true |
| 43 | + |
| 44 | + - name: Build site |
| 45 | + run: bundle exec jekyll b -d "_site/docs" |
| 46 | + env: |
| 47 | + JEKYLL_ENV: "production" |
| 48 | + |
| 49 | + - name: Test site |
| 50 | + run: | |
| 51 | + bundle exec htmlproofer _site --disable-external --check-html --allow_hash_href |
| 52 | +
|
| 53 | + - name: Upload site artifact |
| 54 | + uses: actions/upload-pages-artifact@v1 |
| 55 | + with: |
| 56 | + path: "_site/docs" |
| 57 | + |
| 58 | + deploy: |
| 59 | + environment: |
| 60 | + name: github-pages |
| 61 | + url: ${{ steps.deployment.outputs.page_url }} |
| 62 | + runs-on: ubuntu-latest |
| 63 | + needs: build |
| 64 | + |
| 65 | + steps: |
| 66 | + - name: Deploy to GitHub Pages |
| 67 | + id: deployment |
| 68 | + uses: actions/deploy-pages@v2 |
| 69 | +ndencies preinstalled |
| 70 | + |
| 71 | +on: |
| 72 | + # Runs on pushes targeting the default branch |
| 73 | + push: |
| 74 | + branches: ["main"] |
| 75 | + |
| 76 | + # Allows you to run this workflow manually from the Actions tab |
| 77 | + workflow_dispatch: |
| 78 | + |
| 79 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 80 | +permissions: |
| 81 | + contents: read |
| 82 | + pages: write |
| 83 | + id-token: write |
| 84 | + |
| 85 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 86 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 87 | +concurrency: |
| 88 | + group: "pages" |
| 89 | + cancel-in-progress: false |
| 90 | + |
| 91 | +jobs: |
| 92 | + # Build job |
| 93 | + build: |
| 94 | + runs-on: ubuntu-latest |
| 95 | + steps: |
| 96 | + - name: Checkout |
| 97 | + uses: actions/checkout@v4 |
| 98 | + - name: Setup Pages |
| 99 | + uses: actions/configure-pages@v5 |
| 100 | + - name: Build with Jekyll |
| 101 | + uses: actions/jekyll-build-pages@v1 |
| 102 | + with: |
| 103 | + source: ./ |
| 104 | + destination: ./_site |
| 105 | + - name: Upload artifact |
| 106 | + uses: actions/upload-pages-artifact@v3 |
| 107 | + |
| 108 | + # Deployment job |
| 109 | + deploy: |
| 110 | + environment: |
| 111 | + name: github-pages |
| 112 | + url: ${{ steps.deployment.outputs.page_url }} |
| 113 | + runs-on: ubuntu-latest |
| 114 | + needs: build |
| 115 | + steps: |
| 116 | + - name: Deploy to GitHub Pages |
| 117 | + id: deployment |
| 118 | + uses: actions/deploy-pages@v4 |
0 commit comments