Skip to content

Commit 3954f18

Browse files
committed
Ensure badges are updated and tags pushed
1 parent f667fd8 commit 3954f18

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,18 @@ jobs:
8484
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
8585
8686
# Increment package version:
87-
npm version ${{ github.event.inputs.version }}
87+
npm version ${{ github.event.inputs.version }} --no-git-tag-version
88+
89+
# Define variable for new version:
90+
NEW_VERSION=$(node -p "require('./package.json').version")
91+
92+
# Replace branch in README.md link definitions for badges with the new version:
93+
find . -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/branch=[^ ]+/branch=v${NEW_VERSION}/g"
94+
95+
# Create a new commit and tag:
96+
git add package.json README.md
97+
git commit -m "Release v${NEW_VERSION}"
98+
git tag -a "v${NEW_VERSION}" -m "Release v{NEW_VERSION}"
8899
89100
# Push changes to GitHub:
90101
git push --follow-tags

0 commit comments

Comments
 (0)