Replace providers #4
Workflow file for this run
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: ChipFlow Libraray Github Pages | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| branches: | |
| - main | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| issues: write | |
| pull-requests: write | |
| # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
| # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build_and_deploy_docs: | |
| runs-on: ubuntu-latest | |
| name: Build and Deploy Docs | |
| env: | |
| PR_PATH: pull/${{github.event.number}} | |
| steps: | |
| - name: Delete old doc PR comment | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: hasura/[email protected] | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| repository: ${{ github.repository }} | |
| number: ${{ github.event.number }} | |
| id: deploy-preview | |
| delete: true | |
| - name: Comment on PR | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: hasura/[email protected] | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| repository: ${{ github.repository }} | |
| number: ${{ github.event.number }} | |
| id: deploy-preview | |
| message: "Starting deployment of preview ⏳..." | |
| recreate: true | |
| - name: Get Site URL | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| url=$(gh api "repos/$GITHUB_REPOSITORY/pages" --jq '.html_url' | sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/') | |
| echo "DOMAIN=$url" >> $GITHUB_ENV | |
| - name: Set production base URL | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| run: echo "BASE_URL=https://${{ env.DOMAIN }}/" >> $GITHUB_ENV | |
| - name: Set base URL for preview if PR | |
| if: ${{ github.event_name == 'pull_request' }} | |
| run: echo "BASE_URL=https://${{ env.DOMAIN }}/${{ env.PR_PATH}}/" >> $GITHUB_ENV | |
| - uses: actions/checkout@v2 | |
| with: | |
| submodules: true | |
| - uses: actions/checkout@v4 | |
| - name: Setup PDM | |
| uses: pdm-project/setup-pdm@v4 | |
| with: | |
| python-version: 3.12 | |
| cache: true | |
| - name: Install dependencies | |
| run: pdm install | |
| - name: Build docs | |
| run: pdm docs | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: html-docs | |
| path: docs/_build | |
| - name: Deploy if this is the `main` branch | |
| uses: peaceiris/actions-gh-pages@v3 | |
| if: ${{ github.ref == 'refs/heads/main' }} | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: site | |
| cname: ${{ env.DOMAIN }} | |
| - name: Deploy to PR preview | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: peaceiris/actions-gh-pages@v3 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: site | |
| destination_dir: ${{ env.PR_PATH }} | |
| - name: Update comment | |
| if: ${{ github.event_name == 'pull_request' }} | |
| uses: hasura/[email protected] | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| repository: ${{ github.repository }} | |
| number: ${{ github.event.number }} | |
| id: deploy-preview | |
| message: "A preview of ${{ github.event.after }} is uploaded and can be seen here:\n\n ✨ ${{ env.BASE_URL }} ✨\n\nChanges may take a few minutes to propagate. Since this is a preview of production, content with `draft: true` will not be rendered. The source is here: https://github.com/${{ github.repository }}/tree/gh-pages/${{ env.PR_PATH }}/" | |
| recreate: true |