Skip to content

Commit 70f3653

Browse files
committed
chore: update CI from bbb-plugin-template v0.0.x
2 parents 10c16ee + 37f4f0b commit 70f3653

1 file changed

Lines changed: 22 additions & 4 deletions

File tree

.github/workflows/publish-tag.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,35 @@ jobs:
2828
user_email="github-actions@github.com"
2929
fi
3030
echo "user_email=$user_email" >> $GITHUB_ENV
31-
31+
3232
- name: Configure Git with the triggering user's info
3333
run: |
3434
git config user.name "${{ github.actor }}"
3535
git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
3636
37-
38-
- name: Bump version and push tag
37+
- name: Bump version, update manifest, commit and tag
3938
run: |
39+
set -euo pipefail
40+
4041
npm install
41-
npm version ${{ github.event.inputs.release_type }} -m "chore: bump version to %s"
42+
43+
# 1) Bump package.json + package-lock.json but DO NOT commit/tag yet
44+
npm version ${{ github.event.inputs.release_type }} --no-git-tag-version
45+
46+
# 2) Read the new version from package.json
47+
NEW_VERSION=$(node -p "require('./package.json').version")
48+
echo "New version is: $NEW_VERSION"
49+
50+
# 3) Update manifest.json's "version" field to match
51+
jq --arg v "$NEW_VERSION" '.version = $v' manifest.json > manifest.json.tmp
52+
mv manifest.json.tmp manifest.json
53+
54+
# 4) Commit everything and create an annotated tag
55+
git add package.json package-lock.json manifest.json
56+
git commit -m "chore: bump version to $NEW_VERSION"
57+
git tag -a "v$NEW_VERSION" -m "v$NEW_VERSION"
58+
59+
# 5) Push commit and tag
4260
git push --follow-tags
4361
env:
4462
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)