|
65 | 65 | with:
|
66 | 66 | user: __token__
|
67 | 67 | password: ${{ secrets.PYPI_API_TOKEN }}
|
| 68 | + |
| 69 | + build-docs: |
| 70 | + runs-on: ubuntu-latest |
| 71 | + steps: |
| 72 | + - uses: actions/checkout@v2 |
| 73 | + - uses: actions/setup-python@v2 |
| 74 | + with: |
| 75 | + python-version: "3.9" |
| 76 | + - name: Install dependencies |
| 77 | + run: | |
| 78 | + python -m pip install -r requirements-dev.txt |
| 79 | + - uses: quarto-dev/quarto-actions/setup@v2 |
| 80 | + - name: Build docs |
| 81 | + run: | |
| 82 | + make build |
| 83 | + # push to netlify ------------------------------------------------------- |
| 84 | + |
| 85 | + # set release name ---- |
| 86 | + |
| 87 | + - name: Configure pull release name |
| 88 | + if: ${{github.event_name == 'pull_request'}} |
| 89 | + run: | |
| 90 | + echo "RELEASE_NAME=pr-${PR_NUMBER}" >> $GITHUB_ENV |
| 91 | + env: |
| 92 | + PR_NUMBER: ${{ github.event.number }} |
| 93 | + - name: Configure branch release name |
| 94 | + if: ${{github.event_name != 'pull_request'}} |
| 95 | + run: | |
| 96 | + # use branch name, but replace slashes. E.g. feat/a -> feat-a |
| 97 | + echo "RELEASE_NAME=${GITHUB_REF_NAME/\//-}" >> $GITHUB_ENV |
| 98 | + # deploy ---- |
| 99 | + |
| 100 | + - name: Create Github Deployment |
| 101 | + |
| 102 | + id: deployment |
| 103 | + with: |
| 104 | + step: start |
| 105 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 106 | + env: ${{ env.RELEASE_NAME }} |
| 107 | + ref: ${{ github.head_ref }} |
| 108 | + transient: true |
| 109 | + logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' |
| 110 | + |
| 111 | + - name: Netlify docs preview |
| 112 | + run: | |
| 113 | + npm install -g netlify-cli |
| 114 | + # push main branch to production, others to preview -- |
| 115 | + if [ "${ALIAS}" == "main" ]; then |
| 116 | + netlify deploy --dir=_build --prod |
| 117 | + else |
| 118 | + netlify deploy --dir=_build --alias="${ALIAS}" |
| 119 | + fi |
| 120 | + env: |
| 121 | + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} |
| 122 | + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
| 123 | + ALIAS: ${{ steps.deployment.outputs.env }} |
| 124 | + |
| 125 | + - name: Update Github Deployment |
| 126 | + |
| 127 | + if: ${{ always() }} |
| 128 | + with: |
| 129 | + step: finish |
| 130 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 131 | + status: ${{ job.status }} |
| 132 | + deployment_id: ${{ steps.deployment.outputs.deployment_id }} |
| 133 | + env_url: 'https://${{ steps.deployment.outputs.env }}--quartodoc.netlify.app' |
| 134 | + logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}' |
0 commit comments