Skip to content

Commit bdf958b

Browse files
authored
chore(ci): add timestamp to snapshot version for better readability (#538)
## Summary - Add `.github/actions/set-snapshot-version` composite action to compute snapshot versions - Change version format from `0.0.0-{sha}` to `0.0.0-{sha}.{timestamp}` for better readability - Add `prepare` job to compute version once at workflow start and pass to downstream jobs ## Test plan - [ ] Verify the release workflow runs successfully - [ ] Check that the version string in release artifacts follows the new format 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent f0a9209 commit bdf958b

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: Set Snapshot Version
2+
description: Set snapshot version (0.0.0-{sha}.{timestamp}) for pre-release builds
3+
4+
outputs:
5+
version:
6+
description: The computed version string
7+
value: ${{ steps.version.outputs.version }}
8+
9+
runs:
10+
using: composite
11+
steps:
12+
- name: Set snapshot version
13+
id: version
14+
shell: bash
15+
run: |
16+
SHORT_SHA=$(echo "${{ github.sha }}" | cut -c1-8)
17+
BUILD_TIME=$(date -u +%Y%m%d-%H%M)
18+
VERSION="0.0.0-${SHORT_SHA}.${BUILD_TIME}"
19+
echo "version=${VERSION}" >> $GITHUB_OUTPUT

.github/workflows/release.yml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,26 @@ permissions: {}
88
env:
99
RELEASE_BUILD: 'true'
1010
DEBUG: 'napi:*'
11-
VERSION: 0.0.0-${{ github.sha }}
1211

1312
jobs:
13+
prepare:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
outputs:
18+
version: ${{ steps.version.outputs.version }}
19+
steps:
20+
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
21+
- uses: ./.github/actions/set-snapshot-version
22+
id: version
23+
1424
build-rust:
1525
runs-on: ${{ matrix.settings.os }}
26+
needs: prepare
1627
permissions:
1728
contents: read
29+
env:
30+
VERSION: ${{ needs.prepare.outputs.version }}
1831
strategy:
1932
fail-fast: false
2033
matrix:
@@ -109,11 +122,13 @@ jobs:
109122

110123
Release:
111124
runs-on: ubuntu-latest
112-
needs: build-rust
125+
needs: [prepare, build-rust]
113126
permissions:
114127
contents: write
115128
packages: write
116129
id-token: write # Required for OIDC
130+
env:
131+
VERSION: ${{ needs.prepare.outputs.version }}
117132
steps:
118133
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
119134
- uses: ./.github/actions/clone

0 commit comments

Comments
 (0)