Skip to content

Commit 8599b58

Browse files
committed
Switch release workflow to tag-triggered (prevent accidental releases)
The previous workflow auto-published on any push to main that changed package.json. This caused an accidental v2.0.0 release when a PR with a version bump was merged. Now the workflow only fires when a v* tag is pushed, giving explicit control over when releases happen. A validation step ensures the tag matches the package.json version before publishing. Release process: bump version in PR → merge → push tag → workflow runs.
1 parent d69829f commit 8599b58

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

.devcontainer/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@
8585

8686
### Fixed
8787

88+
#### CI/CD
89+
- **Release workflow** — switched from auto-publish on `package.json` change to tag-triggered (`v*` tags only); prevents accidental releases when PRs include version bumps. Tag must match `package.json` version or the workflow fails.
90+
8891
#### CCStatusLine Deployment
8992
- **`CONFIG_SOURCE_DIR` deprecation guard**`setup.sh` now detects stale `CONFIG_SOURCE_DIR=/workspaces/.claude` in `.env`, overrides to `$DEVCONTAINER_DIR/config`, and auto-comments the line on disk; the wrong path caused `setup-config.sh` to skip the file manifest entirely, leaving ccstatusline (and all manifest-based configs) undeployed
9093
- **System template directory permissions**`install.sh` now chowns `/usr/local/share/ccstatusline/` to the target user so `setup-config.sh` can write the template file during post-start

.github/workflows/release.yml

Lines changed: 14 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,34 +2,29 @@ name: Release
22

33
on:
44
push:
5-
branches: [main]
6-
paths: ['package.json']
5+
tags: ['v*']
76

87
jobs:
9-
check-version:
8+
validate:
109
runs-on: ubuntu-latest
1110
outputs:
12-
version: ${{ steps.check.outputs.version }}
13-
changed: ${{ steps.check.outputs.changed }}
11+
version: ${{ steps.extract.outputs.version }}
1412
steps:
1513
- uses: actions/checkout@v6
16-
with:
17-
fetch-depth: 2
1814

19-
- id: check
15+
- id: extract
16+
name: Extract and validate version
2017
run: |
21-
CURRENT=$(node -p "require('./package.json').version")
22-
PREVIOUS=$(git show HEAD~1:package.json | node -p "JSON.parse(require('fs').readFileSync('/dev/stdin','utf8')).version" || echo "0.0.0")
23-
echo "version=$CURRENT" >> "$GITHUB_OUTPUT"
24-
if [ "$CURRENT" != "$PREVIOUS" ]; then
25-
echo "changed=true" >> "$GITHUB_OUTPUT"
26-
else
27-
echo "changed=false" >> "$GITHUB_OUTPUT"
18+
TAG="${GITHUB_REF#refs/tags/v}"
19+
PKG=$(node -p "require('./package.json').version")
20+
echo "version=$TAG" >> "$GITHUB_OUTPUT"
21+
if [ "$TAG" != "$PKG" ]; then
22+
echo "::error::Tag v${TAG} does not match package.json version ${PKG}"
23+
exit 1
2824
fi
2925
3026
publish-and-release:
31-
needs: check-version
32-
if: needs.check-version.outputs.changed == 'true'
27+
needs: validate
3328
runs-on: ubuntu-latest
3429
permissions:
3530
contents: write
@@ -49,16 +44,10 @@ jobs:
4944
env:
5045
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
5146

52-
- name: Create git tag
53-
run: |
54-
VERSION="v${{ needs.check-version.outputs.version }}"
55-
git tag "$VERSION"
56-
git push origin "$VERSION"
57-
5847
- name: Extract changelog section
5948
id: changelog
6049
run: |
61-
VERSION="${{ needs.check-version.outputs.version }}"
50+
VERSION="${{ needs.validate.outputs.version }}"
6251
NOTES=$(sed -n "/^## \[v${VERSION}\]/,/^## \[v/{ /^## \[v${VERSION}\]/d; /^## \[v/d; p; }" .devcontainer/CHANGELOG.md)
6352
if [ -z "$NOTES" ]; then
6453
NOTES="Release v${VERSION}"
@@ -69,7 +58,7 @@ jobs:
6958
env:
7059
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7160
run: |
72-
VERSION="v${{ needs.check-version.outputs.version }}"
61+
VERSION="v${{ needs.validate.outputs.version }}"
7362
gh release create "$VERSION" \
7463
--title "$VERSION" \
7564
--notes-file /tmp/release-notes.md

0 commit comments

Comments
 (0)