Skip to content

Commit f19aa93

Browse files
committed
add prerelease workflow
1 parent e57660c commit f19aa93

1 file changed

Lines changed: 115 additions & 0 deletions

File tree

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: Prepare Release
2+
3+
on:
4+
push:
5+
# Per-package tags produced by tagging.py, e.g. "settings/v0.2.0".
6+
# Each tag push fires an independent prepare-release run, producing one
7+
# tarball ready for release.
8+
tags:
9+
- "*/v*"
10+
workflow_dispatch:
11+
inputs:
12+
tag:
13+
description: "Tag to prepare (e.g. settings/v0.2.0)"
14+
required: true
15+
type: string
16+
17+
concurrency:
18+
group: prepare-release-${{ github.ref_name || inputs.tag }}
19+
cancel-in-progress: false
20+
21+
permissions:
22+
contents: read
23+
id-token: write
24+
25+
jobs:
26+
prepare:
27+
name: Prepare ${{ github.ref_name || inputs.tag }}
28+
runs-on:
29+
group: databricks-protected-runner-group
30+
labels: linux-ubuntu-latest
31+
timeout-minutes: 20
32+
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
36+
with:
37+
# Fetch tags + full history so git for-each-ref can read the
38+
# annotated tag body (where tagging.py stores release notes).
39+
fetch-depth: 0
40+
ref: ${{ inputs.tag || github.ref }}
41+
42+
- name: Parse tag into package and version
43+
id: parse
44+
run: |
45+
tag="${{ inputs.tag || github.ref_name }}"
46+
package="${tag%/v*}"
47+
version="${tag##*/v}"
48+
echo "tag=$tag" >> "$GITHUB_OUTPUT"
49+
echo "package=$package" >> "$GITHUB_OUTPUT"
50+
echo "version=$version" >> "$GITHUB_OUTPUT"
51+
echo "Parsed tag=$tag package=$package version=$version"
52+
53+
- name: Validate package directory exists
54+
run: |
55+
if [ ! -f "packages/${{ steps.parse.outputs.package }}/package.json" ]; then
56+
echo "::error::No package.json at packages/${{ steps.parse.outputs.package }}/"
57+
echo "Tag ${{ steps.parse.outputs.tag }} does not correspond to a workspace package."
58+
exit 1
59+
fi
60+
61+
- name: Setup JFrog CLI
62+
uses: jfrog/setup-jfrog-cli@279b1f629f43dd5bc658d8361ac4802a7ef8d2d5 # v4.9.1
63+
env:
64+
JF_URL: https://databricks.jfrog.io
65+
with:
66+
oidc-provider-name: github-actions
67+
68+
- name: Setup Node.js
69+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
70+
with:
71+
node-version: "22"
72+
cache: "npm"
73+
74+
- name: Configure npm for JFrog
75+
run: jf npmc --repo-resolve=db-npm
76+
77+
- name: Install dependencies
78+
run: jf npm ci
79+
80+
- name: Build workspace
81+
run: npm run build
82+
83+
- name: Pack package tarball
84+
id: pack
85+
working-directory: packages/${{ steps.parse.outputs.package }}
86+
run: |
87+
# npm pack emits the filename on stdout; capture it so release can
88+
# match it without guessing the scope's underscore-encoding.
89+
tarball=$(npm pack --silent)
90+
echo "tarball=packages/${{ steps.parse.outputs.package }}/${tarball}" >> "$GITHUB_OUTPUT"
91+
echo "Packed $tarball"
92+
93+
- name: Stage release artifacts
94+
id: stage
95+
run: |
96+
mkdir -p release-artifacts
97+
cp "${{ steps.pack.outputs.tarball }}" release-artifacts/
98+
echo "${{ steps.parse.outputs.version }}" > release-artifacts/VERSION
99+
echo "${{ steps.parse.outputs.package }}" > release-artifacts/PACKAGE
100+
echo "${{ steps.parse.outputs.tag }}" > release-artifacts/TAG
101+
# tagging.py embeds the NEXT_CHANGELOG section into the annotated
102+
# tag body; extract it verbatim for release to attach to the GitHub
103+
# release.
104+
git for-each-ref --format='%(body)' "refs/tags/${{ steps.parse.outputs.tag }}" > release-artifacts/changelog-diff.md
105+
(cd release-artifacts && sha256sum *.tgz VERSION PACKAGE TAG changelog-diff.md > SHA256SUMS)
106+
echo "Artifacts staged:"
107+
ls -la release-artifacts/
108+
109+
- name: Upload release artifacts
110+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
111+
with:
112+
name: sdk-js-release-${{ github.run_number }}
113+
retention-days: 7
114+
if-no-files-found: error
115+
path: release-artifacts/

0 commit comments

Comments
 (0)