Skip to content

Commit f94f317

Browse files
committed
ci: publish to netlify
1 parent 5f70146 commit f94f317

File tree

2 files changed

+70
-0
lines changed

2 files changed

+70
-0
lines changed

.github/workflows/ci.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,70 @@ jobs:
6565
with:
6666
user: __token__
6767
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+
uses: bobheadxi/[email protected]
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+
uses: bobheadxi/[email protected]
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 }}'

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,6 @@ dmypy.json
138138
# Pyre type checker
139139
.pyre/
140140
.Rproj.user
141+
142+
# Local Netlify folder
143+
.netlify

0 commit comments

Comments
 (0)