Set implementation #379
Workflow file for this run
This file contains 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: GitHub Pages | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
deploy: | |
if: github.event.pull_request.head.repo.owner.login == 'dfinity' | |
strategy: | |
matrix: | |
node: [20] | |
concurrency: gh-pages-${{ github.ref }} | |
runs-on: ubuntu-20.04 | |
env: | |
PR_PATH: pull/${{github.event.number}} | |
steps: | |
- name: Checkout website repo | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
- name: Setup dfx | |
uses: dfinity/setup-dfx@main | |
- run: dfx cache install | |
- name: Build docs | |
run: npm run docs | |
- name: Deploy if main branch | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref == 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs | |
- name: Deploy to PR preview | |
uses: peaceiris/actions-gh-pages@v3 | |
if: github.ref != 'refs/heads/main' | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./docs | |
destination_dir: ${{ env.PR_PATH }} | |
- name: Update comment | |
uses: hasura/[email protected] | |
if: github.ref != 'refs/heads/main' | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
repository: ${{ github.repository }} | |
number: ${{ github.event.number }} | |
id: deploy-preview | |
message: "✨ Documentation preview for ${{ github.event.after || github.event.pull_request.head.sha }}:\n\n> **https://dfinity.github.io/${{ github.event.repository.name }}/${{ env.PR_PATH}}** ([source code](https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/))" |