|
| 1 | +# Simple workflow for deploying static content to GitHub Pages |
| 2 | +name: Deploy Jekyll site and static content to Pages |
| 3 | + |
| 4 | +# Sample workflow for building and deploying a Jekyll site to GitHub Pages |
| 5 | +name: Deploy Jekyll with GitHub Pages dependencies preinstalled |
| 6 | + |
| 7 | +on: |
| 8 | + # Run on master branch after the static builds are successful |
| 9 | + workflow_run: |
| 10 | + workflows: ["Generate static binaries"] |
| 11 | + branches: [$default-branch] |
| 12 | + types: |
| 13 | + - completed |
| 14 | + |
| 15 | + # Allows you to run this workflow manually from the Actions tab |
| 16 | + workflow_dispatch: |
| 17 | + |
| 18 | +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 19 | +permissions: |
| 20 | + contents: read |
| 21 | + pages: write |
| 22 | + id-token: write |
| 23 | + |
| 24 | +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. |
| 25 | +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. |
| 26 | +concurrency: |
| 27 | + group: "pages" |
| 28 | + cancel-in-progress: false |
| 29 | + |
| 30 | +jobs: |
| 31 | + # Build job |
| 32 | + build: |
| 33 | + runs-on: ubuntu-latest |
| 34 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 35 | + steps: |
| 36 | + - name: Checkout |
| 37 | + uses: actions/checkout@v4 |
| 38 | + - name: Setup Pages |
| 39 | + uses: actions/configure-pages@v4 |
| 40 | + - name: Build with Jekyll |
| 41 | + uses: actions/jekyll-build-pages@v1 |
| 42 | + with: |
| 43 | + source: ./ |
| 44 | + destination: ./_site |
| 45 | + # Not the default gh download-artifact action, which doesn't work |
| 46 | + # between workflows |
| 47 | + - name: Get previous artifact learn-ocaml-www.zip |
| 48 | + uses: dawidd6/action-download-artifact@v2 |
| 49 | + with: |
| 50 | + workflow: ${{ github.event.workflow_run.workflow_id }} |
| 51 | + name: learn-ocaml-www.zip |
| 52 | + path: _site/artifacts/ |
| 53 | + - name: Get previous artifact learn-ocaml-linux-x86_64 |
| 54 | + uses: dawidd6/action-download-artifact@v2 |
| 55 | + with: |
| 56 | + workflow: ${{ github.event.workflow_run.workflow_id }} |
| 57 | + name: learn-ocaml-linux-x86_64 |
| 58 | + path: _site/artifacts/ |
| 59 | + - name: Get previous artifact learn-ocaml-darwin-x86_64 |
| 60 | + uses: dawidd6/action-download-artifact@v2 |
| 61 | + with: |
| 62 | + workflow: ${{ github.event.workflow_run.workflow_id }} |
| 63 | + name: learn-ocaml-darwin-x86_64 |
| 64 | + path: _site/artifacts/ |
| 65 | + - name: Generate HTML index |
| 66 | + run: | |
| 67 | + cd _site/artifacts |
| 68 | + tree -H . -L 1 --noreport --dirsfirst -T Learn-ocaml latest development artifacts' --charset utf-8 -o index.html |
| 69 | + - name: Upload artifact |
| 70 | + uses: actions/upload-pages-artifact@v2 |
| 71 | + |
| 72 | + # Deployment job |
| 73 | + deploy: |
| 74 | + # Don't run if tests failed |
| 75 | + if: ${{ github.event.workflow_run.conclusion == 'success' }} |
| 76 | + environment: |
| 77 | + name: github-pages |
| 78 | + url: ${{ steps.deployment.outputs.page_url }} |
| 79 | + runs-on: ubuntu-latest |
| 80 | + needs: build |
| 81 | + steps: |
| 82 | + - name: Deploy to GitHub Pages |
| 83 | + id: deployment |
| 84 | + uses: actions/deploy-pages@v3 |
0 commit comments