Skip to content

Commit d0aadff

Browse files
committed
build: Workflow to attach Lab as ZIP to release
1 parent d2b5321 commit d0aadff

1 file changed

Lines changed: 60 additions & 0 deletions

File tree

.github/workflows/lab.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Panel Lab docs
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: "Release to attach the Panel Lab docs to (e.g. 6.1.0)"
11+
required: true
12+
dry_run:
13+
description: "Skip uploading to the release (for testing)"
14+
type: boolean
15+
default: false
16+
17+
jobs:
18+
build-and-upload:
19+
name: "Build & upload Lab JSON docs"
20+
runs-on: ubuntu-22.04
21+
timeout-minutes: 10
22+
23+
permissions:
24+
contents: write # required to upload release assets
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # pin@v4
29+
with:
30+
ref: ${{ github.event.release.tag_name || inputs.tag }}
31+
32+
- name: Set up Node.js and cache npm dependencies
33+
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # pin@v4
34+
with:
35+
cache: "npm"
36+
cache-dependency-path: panel/package-lock.json
37+
38+
- name: Install npm dependencies
39+
run: npm ci
40+
working-directory: panel
41+
42+
- name: Build Lab JSON docs
43+
run: npm run build:docs
44+
working-directory: panel
45+
46+
- name: Create ZIP archive
47+
run: |
48+
VERSION="${{ github.event.release.tag_name || inputs.tag }}"
49+
zip -r "lab-${VERSION}.zip" dist/ui/
50+
working-directory: panel
51+
52+
- name: Upload Lab ZIP to release
53+
if: ${{ !inputs.dry_run }}
54+
env:
55+
GH_TOKEN: ${{ github.token }}
56+
run: |
57+
VERSION="${{ github.event.release.tag_name || inputs.tag }}"
58+
gh release upload "${VERSION}" \
59+
"panel/lab-${VERSION}.zip" \
60+
--clobber

0 commit comments

Comments
 (0)