Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:

environment: release

outputs:
version: ${{ steps.version.outputs.version }}

permissions:
contents: write
id-token: write
Expand Down Expand Up @@ -61,6 +64,18 @@ jobs:
echo "dry_run=${{ inputs.dry-run }}" >> $GITHUB_OUTPUT
fi

- name: Determine version
id: version
if: steps.mode.outputs.dry_run != 'true'
run: |
VERSION=$(pnpm exec release-it --release-version --ci 2>/dev/null) || true
if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Next version: $VERSION"
else
echo "No releasable version detected"
fi

- name: Release
run: |
if [ "${{ steps.mode.outputs.dry_run }}" == "true" ]; then
Expand All @@ -70,3 +85,43 @@ jobs:
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

sync-template:
runs-on:
group: databricks-protected-runner-group
labels: linux-ubuntu-latest

needs: release
# in case a dry run is performed, the version is not set so we need to check for it.
if: needs.release.outputs.version != ''

permissions:
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 24
cache: "pnpm"

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Sync template and push tag
run: pnpm exec tsx tools/publish-template-tag.ts ${{ needs.release.outputs.version }}
2 changes: 1 addition & 1 deletion .release-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"hooks": {
"after:bump": "tsx tools/sync-versions.ts ${version} && pnpm build:notice && git add NOTICE.md",
"before:release": "pnpm build && pnpm --filter=docs build && pnpm --filter=@databricks/appkit dist && pnpm --filter=@databricks/appkit-ui dist",
"after:release": "npm publish packages/appkit/tmp --access public --provenance && npm publish packages/appkit-ui/tmp --access public --provenance && tsx tools/publish-template-tag.ts ${version}"
"after:release": "npm publish packages/appkit/tmp --access public --provenance && npm publish packages/appkit-ui/tmp --access public --provenance"
},
"plugins": {
"@release-it/conventional-changelog": {
Expand Down
7 changes: 4 additions & 3 deletions tools/publish-template-tag.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env tsx
/**
* Run after npm publish. Syncs the template to the new version (with retry),
* then commits, tags template-vX.X.X, and pushes.
* Syncs the template to the given version (with retry), then commits, tags
* template-vX.X.X, and pushes. Used by the Release workflow (sync-template job
* in .github/workflows/release.yml) and for manual runs.
*/

import { spawnSync } from "node:child_process";
Expand Down Expand Up @@ -75,7 +76,7 @@ if (installExit !== 0) {
// 3. Git add, commit, tag, push
const commands: [string, string[]][] = [
["git", ["add", "template/package.json", "template/package-lock.json"]],
["git", ["commit", "-m", `chore: sync template to v${version}`]],
["git", ["commit", "-m", `chore: sync template to v${version} [skip ci]`]],
["git", ["tag", `template-v${version}`]],
["git", ["push", "origin", "main", "--follow-tags"]],
];
Expand Down