Skip to content

Commit 3d221bf

Browse files
authored
Merge pull request #134 from rstudio/docs-preview
ci: push preview docs
2 parents 1076dc6 + 7dc44aa commit 3d221bf

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

.github/workflows/ci.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,65 @@ jobs:
168168
name: docs-html
169169
path: docs/_build/html/
170170

171+
preview-docs:
172+
name: "Preview Docs:"
173+
runs-on: ubuntu-latest
174+
needs: ["build-docs"]
175+
if: github.event_name == 'pull_request'
176+
steps:
177+
- uses: actions/download-artifact@v3
178+
with:
179+
name: docs-html
180+
path: docs-html
181+
182+
# Determine the release name ---
183+
184+
- name: Configure pull release name
185+
if: ${{github.event_name == 'pull_request'}}
186+
run: |
187+
echo "RELEASE_NAME=pr-${PR_NUMBER}" >> $GITHUB_ENV
188+
env:
189+
PR_NUMBER: ${{ github.event.number }}
190+
191+
# create deployment ----
192+
193+
- name: Create Github Deployment
194+
uses: bobheadxi/[email protected]
195+
id: deployment
196+
with:
197+
step: start
198+
token: ${{ secrets.GITHUB_TOKEN }}
199+
env: ${{ env.RELEASE_NAME }}
200+
ref: ${{ github.head_ref }}
201+
transient: true
202+
logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
203+
204+
# push docs ----
205+
206+
- name: Netlify docs preview
207+
run: |
208+
npm install -g netlify-cli
209+
# push main branch to production, others to preview --
210+
netlify deploy --dir=docs-html --alias="${ALIAS}"
211+
212+
env:
213+
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
214+
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
215+
ALIAS: ${{ steps.deployment.outputs.env }}
216+
217+
# update deployment ----
218+
219+
- name: Update Github Deployment
220+
uses: bobheadxi/[email protected]
221+
if: ${{ always() }}
222+
with:
223+
step: finish
224+
token: ${{ secrets.GITHUB_TOKEN }}
225+
status: ${{ job.status }}
226+
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
227+
env_url: 'https://${{ steps.deployment.outputs.env }}--pins-python.netlify.app'
228+
logs: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
229+
171230
publish-docs:
172231
name: "Publish Docs"
173232
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)