Skip to content

Commit 72a2acd

Browse files
committed
add deploy workflow
1 parent 09d2d44 commit 72a2acd

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: 📕 Deploy headless docs
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request: # TODO remove
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
pages: write
14+
contents: write
15+
16+
jobs:
17+
deploy:
18+
name: 📕 Deploy headless docs
19+
runs-on: ubuntu-latest
20+
21+
env:
22+
PRODUCTION_REMOTE: https://git:${{ secrets.DEPLOY_TOKEN || secrets.GITHUB_TOKEN }}@github.com/${{ vars.DEPLOY_REPOSITORY || github.repository }}
23+
24+
steps:
25+
- name: 📥 Checkout repo
26+
uses: actions/checkout@v4
27+
28+
- name: ⚙️ Setup node
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 20
32+
cache: yarn
33+
34+
- name: ⚙️ Setup git
35+
run: |
36+
echo Deploying to pages to $PRODUCTION_REMOTE
37+
git remote set-url origin https://git:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}
38+
git remote add production $PRODUCTION_REMOTE
39+
git config --global user.email [email protected]
40+
git config --global user.name github-actions-bot
41+
42+
- name: 📥 Download deps
43+
run: yarn install --frozen-lockfile
44+
45+
- name: 🔨 Build
46+
run: cd docs_headless && yarn build
47+
48+
- name: 📡 Deploy GitHub pages
49+
run: npx gh-pages --remote production -d dist -b ${{ vars.DEPLOY_BRANCH || 'gh-pages' }}
50+
env:
51+
GITHUB_TOKEN: ${{ secrets.DEPLOY_TOKEN || secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)