Merge pull request #148 from IBM/dependabot/github_actions/step-secur… #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish website | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'data/**' | |
| - 'docs/**' | |
| - 'notebooks/**' | |
| - 'mkdocs.ya?ml' | |
| - '.github/workflows/publish.ya?ml' # This workflow | |
| workflow_dispatch: | |
| env: | |
| LC_ALL: en_US.UTF-8 | |
| defaults: | |
| run: | |
| shell: bash | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Harden Runner" | |
| uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0 | |
| with: | |
| disable-sudo-and-containers: true | |
| egress-policy: block | |
| allowed-endpoints: > | |
| api.github.com:443 | |
| files.pythonhosted.org:443 | |
| fonts.google.com:443 | |
| fonts.gstatic.com:443 | |
| github.com:443 | |
| objects.githubusercontent.com:443 | |
| pypi.org:443 | |
| raw.githubusercontent.com:443 | |
| release-assets.githubusercontent.com:443 | |
| releases.astral.sh:443 | |
| - name: 'Checkout' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: 'Setup Pages' | |
| if: ${{ github.event_name != 'pull_request' }} | |
| uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 | |
| - name: 'Setup Python' | |
| id: python | |
| uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0 | |
| with: | |
| python-version: 3.12 | |
| - name: 'Setup uv' | |
| uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8.0.0 | |
| with: | |
| python-version: ${{ steps.python.outputs.python-version }} | |
| enable-cache: false | |
| - name: 'Build website' | |
| run: | | |
| uvx --with 'mkdocs-macros-plugin' --with 'mkdocs-material[imaging]' -- mkdocs build --strict | |
| - name: 'Upload artifact' | |
| if: ${{ github.event_name != 'pull_request' }} | |
| uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.0.0 | |
| with: | |
| path: 'site/' # mkdocs default site_dir | |
| publish: | |
| needs: build | |
| if: ${{ github.event_name != 'pull_request' }} | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Harden Runner" | |
| uses: step-security/harden-runner@6c3c2f2c1c457b00c10c4848d6f5491db3b629df # v2.18.0 | |
| with: | |
| disable-sudo-and-containers: true | |
| egress-policy: block | |
| allowed-endpoints: | | |
| api.github.com:443 | |
| - name: 'Deploy to GitHub Pages' | |
| id: deployment | |
| uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 |