Skip to content

Commit 8eb65f9

Browse files
committed
ci: update GitHub Actions workflows for website deployment and documentation publishing
1 parent 5540c6f commit 8eb65f9

File tree

3 files changed

+30
-28
lines changed

3 files changed

+30
-28
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,9 @@ jobs:
6262
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6363
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
6464
run: yarn release
65+
- name: "Trigger Website workflow"
66+
run: |
67+
curl -X POST https://api.github.com/repos/tsedio/formio/actions/workflows/website.yml/dispatches \
68+
-H 'Accept: application/vnd.github.everest-preview+json' \
69+
-H 'Authorization: Bearer ${{secrets.GH_TOKEN}}' \
70+
--data '{"ref": "${{github.ref_name}}"}'

.github/workflows/website.yml

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,11 @@ concurrency:
2323

2424
jobs:
2525
# Build job
26-
build:
26+
publish-docs:
2727
runs-on: ubuntu-latest
28+
permissions:
29+
pages: write # to deploy to Pages
30+
id-token: write # to verify the deployment originates from an appropriate source
2831
steps:
2932
- name: Checkout
3033
uses: actions/checkout@v4
@@ -40,29 +43,12 @@ jobs:
4043
- name: Setup Pages
4144
uses: actions/configure-pages@v4
4245
- name: Install dependencies
43-
run: yarn install
46+
run: yarn install --immutable --network-timeout 500000
4447
- name: Build with Storybook
45-
run: |
46-
yarn storybook:build
47-
touch ./storybook-static/.nojekyll
48-
echo "formio.tsed.dev" > ./storybook-static/CNAME
49-
- name: Upload artifact
50-
uses: actions/upload-pages-artifact@v3
51-
with:
52-
path: ./storybook-static
53-
54-
# Deployment job
55-
deploy:
56-
name: Deploy
57-
needs: build
58-
permissions:
59-
pages: write # to deploy to Pages
60-
id-token: write # to verify the deployment originates from an appropriate source
61-
environment:
62-
name: github-pages
63-
url: ${{ steps.deployment.outputs.page_url }}
64-
runs-on: ubuntu-latest
65-
steps:
66-
- name: Deploy to GitHub Pages
67-
id: deployment
68-
uses: actions/deploy-pages@v4
48+
run: yarn storybook:build
49+
- name: Publish pages
50+
env:
51+
CI: true
52+
GH_TOKEN: ${{ secrets.GH_TOKEN }}
53+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
54+
run: yarn docs:publish

package.json

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"build-storybook": "storybook build -c .storybook",
3232
"caniuse": "npx -y update-browserslist-db@latest",
3333
"chromatic": "npx chromatic",
34-
"watch": "nodemon --watch ./src --ext ts,js,ejs --exec \"yarn build\""
34+
"watch": "nodemon --watch ./src --ext ts,js,ejs --exec \"yarn build\"",
35+
"docs:publish": "CI=1 monorepo publish ghpages"
3536
},
3637
"dependencies": {
3738
"@formio/js": "^5.3.1",
@@ -144,7 +145,16 @@
144145
"monorepo": {
145146
"productionBranch": "master",
146147
"developBranch": "master",
147-
"npmAccess": "public"
148+
"npmAccess": "public",
149+
"ghpages": [
150+
{
151+
"dir": "./storybook-static",
152+
"url": "https://github.com/tsedio/tsed-formio.git",
153+
"branch": "gh-pages",
154+
"cname": "formio.tsed.dev",
155+
"if": "master"
156+
}
157+
]
148158
},
149159
"packageManager": "yarn@4.1.1",
150160
"browserslist": {

0 commit comments

Comments
 (0)