Skip to content

Commit f72a2a9

Browse files
committed
ci: add workflow to build and publish gh page
1 parent 4e96196 commit f72a2a9

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

.github/workflows/build.sh

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
if [ "$#" -ne 1 ]; then
6+
echo "arg #1 must be a release tag name" && exit 1
7+
fi
8+
9+
RELEASE_TAG_NAME="$1"
10+
11+
# download openapi.yaml
12+
curl -L \
13+
-o openapi.yaml \
14+
https://github.com/gclaussn/go-bpmn/releases/download/${RELEASE_TAG_NAME}/go-bpmn-openapi.yaml
15+
16+
# build OpenAPI docs
17+
npx @redocly/cli build-docs \
18+
--title "go-bpmn HTTP API (${RELEASE_TAG_NAME})" \
19+
--output openapi.html \
20+
openapi.yaml
21+
22+
# build Github page
23+
npm run build
24+
25+
# include OpenAPI docs
26+
mv openapi.html ./dist/

.github/workflows/publish.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Publish
2+
on:
3+
push:
4+
branches:
5+
- "gh-page"
6+
jobs:
7+
build:
8+
runs-on: ubuntu-22.04
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
- name: Set up node
13+
uses: actions/setup-node@v4
14+
with:
15+
node-version-file: package.json
16+
cache: npm
17+
cache-dependency-path: package-lock.json
18+
- name: Clean install
19+
run: npm ci
20+
- name: Build
21+
run: bash ./.github/workflows/build.sh v0.1.0 # need to be manually increased
22+
- name: Upload pages artifact
23+
uses: actions/upload-pages-artifact@v3
24+
with:
25+
path: dist/
26+
deploy:
27+
runs-on: ubuntu-22.04
28+
needs: build
29+
permissions:
30+
pages: write
31+
id-token: write
32+
environment:
33+
name: github-pages
34+
url: ${{ steps.deployment.outputs.page_url }}
35+
steps:
36+
- name: Deploy pages
37+
uses: actions/deploy-pages@v4
38+
id: deployment

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ pnpm-debug.log*
1919

2020
# macOS-specific files
2121
.DS_Store
22+
23+
openapi.html
24+
openapi.yaml

0 commit comments

Comments
 (0)