Skip to content
Merged
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
19 changes: 11 additions & 8 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ on:
workflow_run:
workflows: ["CI"]
types: [completed]
branches: [main]
branches: [main, dev]
workflow_dispatch:

permissions:
contents: write

concurrency:
# This workflow always writes to `dev`, regardless of the trigger ref.
group: version-dev
cancel-in-progress: false

Expand All @@ -24,10 +23,14 @@ jobs:
(github.event_name == 'workflow_dispatch') ||
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
github.event.workflow_run.head_branch == 'main' &&
startsWith(github.event.workflow_run.head_commit.message, 'Merge pull request') &&
contains(github.event.workflow_run.head_commit.message, '/dev') &&
!contains(github.event.workflow_run.head_commit.message, '[skip ci]'))
!contains(github.event.workflow_run.head_commit.message, '[skip ci]') &&
(
(github.event.workflow_run.head_branch == 'main' &&
startsWith(github.event.workflow_run.head_commit.message, 'Merge pull request') &&
contains(github.event.workflow_run.head_commit.message, '/dev'))
||
(github.event.workflow_run.head_branch == 'dev')
))

steps:
- uses: actions/checkout@v4
Expand All @@ -52,9 +55,9 @@ jobs:
id: version
run: |
TODAY=$(date -u +%y%m%d)
EXISTING=$(git tag --list "v3.${TODAY}.*" | wc -l)
EXISTING=$(git tag --list "v4.${TODAY}.*" | wc -l)
BUILD_NUMBER=$((EXISTING + 1))
VERSION="3.${TODAY}.${BUILD_NUMBER}"
VERSION="4.${TODAY}.${BUILD_NUMBER}"
Comment on lines +58 to +60

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep derived tag major in sync with published package version

This change derives 4.YYMMDD.N in the workflow, but bun run version still generates 3.YYMMDD.N from scripts/version.ts (see git tag --list "v3..." and return 3.${datePrefix}.${n}``), and that script is what updates package.json before publish. In runs on `dev`, this will create `v4.` tags while publishing `3.` package versions, and subsequent same-day runs can attempt to publish an unchanged npm version while continuing to mint new tags.

Useful? React with 👍 / 👎.

echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
echo "build_number=${BUILD_NUMBER}" >> "$GITHUB_OUTPUT"
echo "Derived version: ${VERSION}"
Expand Down
Loading