gh_pages_deploy.yaml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. name: GitHub Pages deploy
  5. on:
  6. # Runs on pushes targeting the default branch.
  7. push:
  8. branches: ['trunk']
  9. # Allows you to run this workflow manually from the Actions tab.
  10. workflow_dispatch:
  11. # Cancel previous workflows on the PR when there are multiple fast commits.
  12. # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#concurrency
  13. concurrency:
  14. group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
  15. cancel-in-progress: true
  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. jobs:
  22. build:
  23. runs-on: ubuntu-latest
  24. steps:
  25. - name: Harden Runner
  26. uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
  27. with:
  28. egress-policy: audit
  29. - name: Checkout
  30. uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
  31. - name: Prebuild actions
  32. run: ./website/prebuild.py
  33. - name: Setup Pages
  34. uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
  35. - name: Setup Ruby
  36. uses: ruby/setup-ruby@a6e6f86333f0a2523ece813039b8b4be04560854 # v1.190.0
  37. with:
  38. # Runs 'bundle install' and caches installed gems automatically.
  39. bundler-cache: true
  40. # Increment this number if you need to re-download cached gems.
  41. cache-version: 0
  42. - name: Build with Jekyll
  43. env:
  44. JEKYLL_ENV: production
  45. run: |
  46. bundle exec jekyll build --verbose \
  47. --source ./ \
  48. --destination ./_site \
  49. --baseurl "${{ steps.pages.outputs.base_path }}"
  50. - name: Upload artifact
  51. # Automatically uploads an artifact from the './_site' directory by
  52. # default.
  53. uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1
  54. deploy:
  55. environment:
  56. name: github-pages
  57. url: ${{ steps.deployment.outputs.page_url }}
  58. runs-on: ubuntu-latest
  59. needs: build
  60. steps:
  61. - name: Harden Runner
  62. uses: step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
  63. with:
  64. egress-policy: audit
  65. - name: Deploy to GitHub Pages
  66. id: deployment
  67. uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5