Skip to content

Commit ac70ae9

Browse files
committed
add release workflow
1 parent c3ff966 commit ac70ae9

1 file changed

Lines changed: 73 additions & 0 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Build and Release Chart
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
workflow_dispatch:
8+
inputs:
9+
tag_name:
10+
description: 'Tag name for the release (for example: v1.2.0)'
11+
required: true
12+
type: string
13+
ref:
14+
description: 'Git ref to build (branch, tag, or commit SHA)'
15+
required: false
16+
default: 'main'
17+
type: string
18+
19+
permissions:
20+
contents: write
21+
22+
jobs:
23+
release:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Resolve release variables
28+
id: vars
29+
shell: bash
30+
run: |
31+
if [ "${GITHUB_EVENT_NAME}" = "push" ]; then
32+
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
33+
echo "build_ref=${GITHUB_REF}" >> "$GITHUB_OUTPUT"
34+
else
35+
echo "tag=${{ inputs.tag_name }}" >> "$GITHUB_OUTPUT"
36+
echo "build_ref=${{ inputs.ref }}" >> "$GITHUB_OUTPUT"
37+
fi
38+
39+
- name: Checkout source
40+
uses: actions/checkout@v4
41+
with:
42+
ref: ${{ steps.vars.outputs.build_ref }}
43+
44+
- name: Resolve release target commit
45+
id: release_target
46+
shell: bash
47+
run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT"
48+
49+
- name: Setup Node.js
50+
uses: actions/setup-node@v4
51+
with:
52+
node-version: '20'
53+
cache: 'npm'
54+
55+
- name: Install dependencies
56+
run: npm ci
57+
58+
- name: Build bundle
59+
run: npm run build
60+
61+
- name: Ensure chart bundle exists
62+
run: test -f lib/index.umd.js
63+
64+
- name: Create or update GitHub Release
65+
uses: softprops/action-gh-release@v2
66+
with:
67+
tag_name: ${{ steps.vars.outputs.tag }}
68+
target_commitish: ${{ steps.release_target.outputs.sha }}
69+
files: |
70+
lib/index.umd.js
71+
overwrite_files: true
72+
generate_release_notes: true
73+
make_latest: true

0 commit comments

Comments
 (0)