Skip to content

Commit c690235

Browse files
authored
Merge pull request #4 from sourceallies/update-package-by-release-version-attempt-2
Attempt two to update the version in the package.json.
2 parents e09b04b + e5ab426 commit c690235

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

.github/workflows/publish.yml

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
types: [created]
66

77
permissions:
8-
contents: read
8+
contents: write
99
id-token: write
1010

1111
jobs:
@@ -22,14 +22,21 @@ jobs:
2222
registry-url: 'https://registry.npmjs.org'
2323
cache: 'npm'
2424

25-
- name: Update package.json version from release tag
26-
uses: cssnr/update-version-tags-action@v1.2.0 # Use the latest version of the action
27-
with:
28-
# Optional: Commit the changes back to the repository (defaults to true)
29-
commit: false
30-
31-
# Optional: Push the changes back to the repository (defaults to true)
32-
push: false
25+
- name: Extract version from tag
26+
id: get_version
27+
run: |
28+
# Get the tag name (e.g., v1.0.1)
29+
TAG_NAME="${{ github.event.release.tag_name }}"
30+
# Remove 'v' prefix if present
31+
VERSION="${TAG_NAME#v}"
32+
echo "version=${VERSION}" >> $GITHUB_OUTPUT
33+
echo "Extracted version: ${VERSION}"
34+
35+
- name: Update package.json version
36+
run: |
37+
VERSION="${{ steps.get_version.outputs.version }}"
38+
npm version ${VERSION} --no-git-tag-version
39+
echo "Updated package.json to version ${VERSION}"
3340
3441
# Ensure npm 11.5.1 or later is installed
3542
- name: Update npm

0 commit comments

Comments
 (0)