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@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
  27. with:
  28. egress-policy: audit
  29. - name: Checkout
  30. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  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@6ca151fd1bfcfd6fe0c4eb6837eb0584d0134a0c # v1.290.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@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0
  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@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.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