From ac0f6d6bf9d1e84b3d28896e17e221a8216f244c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Halber?= Date: Wed, 20 May 2026 16:47:23 -0700 Subject: [PATCH 1/5] feat: Github release workflow --- .github/workflows/build-binaries.yml | 55 ++++++++++++++++++++++++++ .github/workflows/ci.yml | 40 +------------------ .github/workflows/release.yml | 58 ++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+), 38 deletions(-) create mode 100644 .github/workflows/build-binaries.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml new file mode 100644 index 0000000..0e2f06e --- /dev/null +++ b/.github/workflows/build-binaries.yml @@ -0,0 +1,55 @@ +name: Build binaries + +on: + workflow_call: + +permissions: + contents: read + +jobs: + build-binary: + name: Build-binary (${{ matrix.artifact }}) + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-24.04 + artifact: spark-linux-x64 + ext: "" + - os: ubuntu-24.04-arm + artifact: spark-linux-arm64 + ext: "" + - os: macos-26 + artifact: spark-darwin-arm64 + ext: "" + - os: macos-15-intel + artifact: spark-darwin-x64 + ext: "" + - os: windows-2022 + artifact: spark-win-x64 + ext: ".exe" + - os: windows-11-arm + artifact: spark-win-arm64 + ext: ".exe" + steps: + - name: Checkout + # actions/checkout@v6.0.2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + + - uses: ./.github/actions/setup + + - name: Build SEA binary + run: pnpm build:sea + + - name: Rename binary to asset name + shell: bash + run: mv "dist-sea/spark${{ matrix.ext }}" "dist-sea/${{ matrix.artifact }}${{ matrix.ext }}" + + - name: Upload SEA binary + # actions/upload-artifact@v4.4.3 + uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 + with: + name: ${{ matrix.artifact }} + path: dist-sea/${{ matrix.artifact }}${{ matrix.ext }} + if-no-files-found: error diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 803d465..ac17c00 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,44 +31,8 @@ jobs: run: pnpm build:beau build-binary: - name: Build-binary (${{ matrix.artifact }}) - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-24.04 - artifact: spark-linux-x64 - path: dist-sea/spark - - os: ubuntu-24.04-arm - artifact: spark-linux-arm64 - path: dist-sea/spark - - os: macos-26 - artifact: spark-darwin-arm64 - path: dist-sea/spark - - os: macos-15-intel - artifact: spark-darwin-x64 - path: dist-sea/spark - - os: windows-2022 - artifact: spark-win-x64 - path: dist-sea/spark.exe - steps: - - name: Checkout - # actions/checkout@v6.0.2 - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - - - uses: ./.github/actions/setup - - - name: Build SEA binary - run: pnpm build:sea - - - name: Upload SEA binary - # actions/upload-artifact@v4.4.3 - uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 - with: - name: ${{ matrix.artifact }} - path: ${{ matrix.path }} - if-no-files-found: error + name: Build binaries + uses: ./.github/workflows/build-binaries.yml test: name: Test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..4a19b9b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,58 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + workflow_dispatch: + inputs: + tag: + description: "Release tag (for example v0.1.1)" + required: true + type: string + +permissions: + contents: read + +env: + TAG: ${{ inputs.tag || github.ref_name }} + +jobs: + build: + name: Build binaries + uses: ./.github/workflows/build-binaries.yml + + publish: + name: Publish GitHub Release + needs: build + runs-on: ubuntu-24.04 + environment: release + permissions: + contents: write + steps: + - name: Validate tag + shell: bash + run: | + if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Tag must match v..; got: $TAG" >&2 + exit 1 + fi + + - name: Checkout + # actions/checkout@v6.0.2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + ref: ${{ env.TAG }} + + - name: Download binaries + # actions/download-artifact@v4.1.8 + uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 + with: + path: release-assets + merge-multiple: true + + - name: Create GitHub Release + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: gh release create "$TAG" --generate-notes release-assets/* From a4f22e48944c2f109fc68ff1a620e7cf96f38f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Halber?= Date: Wed, 20 May 2026 16:56:00 -0700 Subject: [PATCH 2/5] feat: compress release binaries --- .github/workflows/build-binaries.yml | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 0e2f06e..0eced0d 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -17,21 +17,27 @@ jobs: - os: ubuntu-24.04 artifact: spark-linux-x64 ext: "" + archive: tar.gz - os: ubuntu-24.04-arm artifact: spark-linux-arm64 ext: "" + archive: tar.gz - os: macos-26 artifact: spark-darwin-arm64 ext: "" + archive: tar.gz - os: macos-15-intel artifact: spark-darwin-x64 ext: "" + archive: tar.gz - os: windows-2022 artifact: spark-win-x64 ext: ".exe" + archive: zip - os: windows-11-arm artifact: spark-win-arm64 ext: ".exe" + archive: zip steps: - name: Checkout # actions/checkout@v6.0.2 @@ -42,14 +48,23 @@ jobs: - name: Build SEA binary run: pnpm build:sea - - name: Rename binary to asset name + - name: Package binary shell: bash - run: mv "dist-sea/spark${{ matrix.ext }}" "dist-sea/${{ matrix.artifact }}${{ matrix.ext }}" + working-directory: dist-sea + run: | + bin="spark${{ matrix.ext }}" + out="${{ matrix.artifact }}.${{ matrix.archive }}" + if [ "${{ matrix.archive }}" = "zip" ]; then + 7z a "$out" "$bin" + else + chmod +x "$bin" + tar -czf "$out" "$bin" + fi - - name: Upload SEA binary + - name: Upload archive # actions/upload-artifact@v4.4.3 uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 with: name: ${{ matrix.artifact }} - path: dist-sea/${{ matrix.artifact }}${{ matrix.ext }} + path: dist-sea/${{ matrix.artifact }}.${{ matrix.archive }} if-no-files-found: error From b96cc3176f267b42c0ed327b757447d2a7471593 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Halber?= Date: Wed, 20 May 2026 17:03:07 -0700 Subject: [PATCH 3/5] chore: update root pkg description --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1d7c177..801ea0d 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "spark", + "//": "The following version is NOT spark's version. Spark version is tracked in packages/spark/package.json", "version": "0.0.0", "private": true, - "description": "Braintrust wizard monorepo", + "description": "CLI wizard to get your project set up with Braintrust", "license": "MIT", "type": "module", "packageManager": "pnpm@10.33.3", From b870f881899cb9243f84702e3222749e972ade52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Halber?= Date: Wed, 20 May 2026 17:11:50 -0700 Subject: [PATCH 4/5] feat: publish release on packages/spark/package.json version increment --- .github/workflows/tag-on-version-bump.yml | 77 +++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 .github/workflows/tag-on-version-bump.yml diff --git a/.github/workflows/tag-on-version-bump.yml b/.github/workflows/tag-on-version-bump.yml new file mode 100644 index 0000000..cd2cdf5 --- /dev/null +++ b/.github/workflows/tag-on-version-bump.yml @@ -0,0 +1,77 @@ +name: tag-on-version-bump + +on: + push: + branches: + - main + paths: + - packages/spark/package.json + +permissions: + actions: write + contents: write + +concurrency: + group: tag-on-version-bump-main + cancel-in-progress: false + +jobs: + create-tag: + runs-on: ubuntu-24.04 + steps: + - name: Checkout + # actions/checkout@v6.0.2 + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + fetch-depth: 0 + fetch-tags: true + + - id: versions + name: Read current and previous versions + shell: bash + run: | + set -euo pipefail + + file=packages/spark/package.json + current="$(jq -r .version "$file")" + if [ -z "$current" ] || [ "$current" = "null" ]; then + echo "Failed to parse version from $file" >&2 + exit 1 + fi + + previous="" + before="${{ github.event.before }}" + if [ -n "$before" ] && [ "$before" != "0000000000000000000000000000000000000000" ] \ + && git cat-file -e "${before}^{commit}" 2>/dev/null; then + previous="$(git show "${before}:${file}" 2>/dev/null | jq -r .version 2>/dev/null || true)" + fi + + tag="v${current}" + echo "tag=$tag" >> "$GITHUB_OUTPUT" + if [ "$current" = "$previous" ]; then + echo "changed=false" >> "$GITHUB_OUTPUT" + echo "Version unchanged ($current); nothing to do." + elif git ls-remote --exit-code --tags origin "refs/tags/${tag}" >/dev/null 2>&1; then + echo "changed=false" >> "$GITHUB_OUTPUT" + echo "Tag $tag already exists; nothing to do." + else + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Create and push tag + if: steps.versions.outputs.changed == 'true' + shell: bash + run: | + set -euo pipefail + tag="${{ steps.versions.outputs.tag }}" + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git tag -a "$tag" -m "Release $tag" "$GITHUB_SHA" + git push origin "refs/tags/$tag" + + - name: Trigger release workflow + if: steps.versions.outputs.changed == 'true' + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + shell: bash + run: gh workflow run release.yml --ref main -f tag="${{ steps.versions.outputs.tag }}" From 7d0ec991be9a2c7ffdc81084523a54e6168bcc0c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Halber?= Date: Wed, 20 May 2026 17:25:14 -0700 Subject: [PATCH 5/5] chore: add checksums --- .github/workflows/build-binaries.yml | 4 ++-- .github/workflows/release.yml | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-binaries.yml b/.github/workflows/build-binaries.yml index 0eced0d..323361f 100644 --- a/.github/workflows/build-binaries.yml +++ b/.github/workflows/build-binaries.yml @@ -31,11 +31,11 @@ jobs: ext: "" archive: tar.gz - os: windows-2022 - artifact: spark-win-x64 + artifact: spark-windows-x64 ext: ".exe" archive: zip - os: windows-11-arm - artifact: spark-win-arm64 + artifact: spark-windows-arm64 ext: ".exe" archive: zip steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4a19b9b..e1c7c02 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,6 +14,10 @@ on: permissions: contents: read +concurrency: + group: release-${{ inputs.tag || github.ref_name }} + cancel-in-progress: false + env: TAG: ${{ inputs.tag || github.ref_name }} @@ -51,6 +55,11 @@ jobs: path: release-assets merge-multiple: true + - name: Generate checksums + shell: bash + working-directory: release-assets + run: sha256sum spark-* > SHA256SUMS + - name: Create GitHub Release env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}