|
3 | 3 | branches: |
4 | 4 | - main |
5 | 5 | pull_request: |
6 | | - branches: |
7 | | - - main |
8 | | - release: |
9 | | - types: |
10 | | - - published |
11 | | - - released |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +permissions: |
| 9 | + contents: read |
| 10 | + pages: write |
| 11 | + id-token: write |
| 12 | + |
| 13 | +concurrency: |
| 14 | + group: "pages" |
| 15 | + cancel-in-progress: false |
12 | 16 |
|
13 | 17 | name: Build and deploy sites |
14 | 18 |
|
15 | 19 | jobs: |
16 | 20 | build: |
17 | 21 | name: Build site and generate HTML |
18 | 22 | runs-on: ubuntu-latest |
19 | | - outputs: |
20 | | - ref-url: ${{ steps.deploy.outputs.deploy-url }} |
21 | 23 |
|
22 | 24 | steps: |
23 | 25 | - name: Install deps for figures (OS packages) |
@@ -129,100 +131,24 @@ jobs: |
129 | 131 | fail: true |
130 | 132 | args: --base './_out/html-multi/' --no-progress --offline './_out/html-multi/**/*.html' |
131 | 133 |
|
132 | | - # deploy-alias computes a URL component for the PR preview. This |
133 | | - # is so we can have a stable name to use for feedback on draft |
134 | | - # material. |
135 | | - - id: deploy-alias |
136 | | - uses: actions/github-script@v7 |
137 | | - name: Compute Alias |
138 | | - with: |
139 | | - script: | |
140 | | - if (process.env.PR) { |
141 | | - return `pr-${process.env.PR}` |
142 | | - } else { |
143 | | - return 'deploy-preview-main'; |
144 | | - } |
145 | | - env: |
146 | | - PR: ${{ github.event.number }} |
147 | | - |
148 | | - # deploy-info computes metadata that's shown in the Netlify interface |
149 | | - # about the deployment (for non-PR deploys) |
150 | | - - id: deploy-info |
151 | | - name: Compute Deployment Metadata |
152 | | - if: github.event_name != 'pull_request' |
153 | | - run: | |
154 | | - set -e |
155 | | - echo "message=$(git log -1 --pretty=format:"%s")" >> "$GITHUB_OUTPUT" |
156 | | -
|
157 | | - # When a release is created in GH, push to the main site without proofreading info |
158 | | - - name: Deploy releases when tags are pushed |
159 | | - id: deploy-release |
160 | | - |
161 | | - if: github.event_name == 'release' |
| 134 | + - name: Upload artifact |
| 135 | + uses: actions/upload-pages-artifact@v3 |
162 | 136 | with: |
163 | | - publish-dir: _out/html-multi |
164 | | - production-branch: main |
165 | | - production-deploy: true |
166 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
167 | | - deploy-message: | |
168 | | - Release from tag ${{ github.ref }} |
169 | | - enable-commit-comment: false |
170 | | - enable-pull-request-comment: false |
171 | | - fails-without-credentials: true |
172 | | - env: |
173 | | - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
174 | | - NETLIFY_SITE_ID: "447031bf-9a96-4cee-831b-1f73599a7cb2" |
175 | | - |
176 | | - # When pushing to `main` or a PR branch, deploy what it would look like if this were released |
177 | | - - name: Deploy current draft |
178 | | - id: deploy-draft |
179 | | - |
180 | | - if: github.event_name == 'push' || github.event_name == 'pull_request' |
181 | | - with: |
182 | | - publish-dir: _out/html-multi |
183 | | - production-branch: main |
184 | | - production-deploy: true |
185 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
186 | | - deploy-message: | |
187 | | - ${{ github.event_name == 'pull_request' && format('pr#{0}: {1}', github.event.number, github.event.pull_request.title) || format('ref/{0}: {1}', github.ref_name, steps.deploy-info.outputs.message) }} |
188 | | - alias: ${{ steps.deploy-alias.outputs.result }} |
189 | | - enable-commit-comment: false |
190 | | - enable-pull-request-comment: false |
191 | | - github-deployment-environment: | |
192 | | - ${{ github.event_name == 'pull_request' && format('lean-ref-pr-#{0}', github.event.number) || 'lean-ref' }} |
193 | | - github-deployment-description: | |
194 | | - Draft without proofreading info |
195 | | - fails-without-credentials: true |
196 | | - env: |
197 | | - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
198 | | - NETLIFY_SITE_ID: "32e0f63e-7a18-4bf9-87f4-713650c7db70" |
199 | | - |
200 | | - # When pushing to `main` or a PR branch, deploy it with proofreading info as well |
201 | | - - name: Deploy with proofreading info (draft mode, for PRs) |
202 | | - id: deploy-draft-proofreading |
203 | | - |
204 | | - if: |
205 | | - github.event_name == 'pull_request' |
206 | | - with: |
207 | | - publish-dir: _out/draft/html-multi |
208 | | - production-branch: main |
209 | | - production-deploy: false |
210 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
211 | | - deploy-message: | |
212 | | - ${{ github.event_name == 'pull_request' && format('pr#{0} proofreading: {1}', github.event.number, github.event.pull_request.title) }} |
213 | | - alias: draft-${{ steps.deploy-alias.outputs.result }} |
214 | | - enable-commit-comment: false |
215 | | - enable-pull-request-comment: false |
216 | | - github-deployment-environment: | |
217 | | - ${{ github.event_name == 'pull_request' && format('lean-ref-pr-draft-#{0}', github.event.number) }} |
218 | | - github-deployment-description: | |
219 | | - Draft with proofreading info |
220 | | - fails-without-credentials: true |
221 | | - env: |
222 | | - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} |
223 | | - NETLIFY_SITE_ID: "32e0f63e-7a18-4bf9-87f4-713650c7db70" |
224 | | - |
225 | | - |
| 137 | + path: _out/html-multi |
| 138 | + |
| 139 | + # Deployment job |
| 140 | + deploy: |
| 141 | + if: github.ref == 'refs/heads/main' |
| 142 | + environment: |
| 143 | + name: github-pages |
| 144 | + url: ${{ steps.deployment.outputs.page_url }} |
| 145 | + runs-on: ubuntu-latest |
| 146 | + needs: build |
| 147 | + steps: |
| 148 | + - name: Deploy to GitHub Pages |
| 149 | + id: deployment |
| 150 | + uses: actions/deploy-pages@v4 |
| 151 | + |
226 | 152 |
|
227 | 153 | check-links: |
228 | 154 | name: Check links |
|
0 commit comments