Skip to content

Commit c4d61c6

Browse files
committed
Fix add git tags in github actions
1 parent 87aa08d commit c4d61c6

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

.github/workflows/publish-package.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55

66
permissions:
7-
contents: read
7+
contents: write
88
packages: write
99

1010
concurrency:
@@ -21,10 +21,23 @@ jobs:
2121
with:
2222
node-version: "18.16.0"
2323
registry-url: "https://registry.npmjs.org"
24-
- run: yarn install
25-
- run: yarn run build
24+
- name: Set version number to environment variable
25+
run: node -p -e '`RELEASED_PACKAGE_VERSION=${require("./package.json").version}`' >> $GITHUB_ENV
26+
- name: Install node_modules
27+
run: yarn install
28+
- name: Create package
29+
run: yarn run build
2630
env:
2731
NODE_ENV: "production"
28-
- run: yarn publish --access public
32+
- name: Publish package
33+
run: yarn publish --access public
2934
env:
3035
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
- name: Create version tag
37+
run: |
38+
git config --global user.name 'github-actions[bot]'
39+
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
40+
git tag -a v${{ env.RELEASED_PACKAGE_VERSION }} -m 'Version ${{ env.RELEASED_PACKAGE_VERSION }}'
41+
git tag v0 v${{ env.RELEASED_PACKAGE_VERSION }}
42+
git push origin v${{ env.RELEASED_PACKAGE_VERSION }}
43+
git push origin v0 --force

0 commit comments

Comments
 (0)