From 8cf8d22dcf9113067fa21e289fe5ceab0203ada3 Mon Sep 17 00:00:00 2001 From: Tomas Pilar Date: Wed, 10 Jan 2024 11:49:47 +0100 Subject: [PATCH 1/2] feat(release): automatic version bump Signed-off-by: Tomas Pilar --- .github/workflows/npm-publish.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 4bb8fd5..120748d 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -18,6 +18,11 @@ jobs: node-version: 16 registry-url: https://registry.npmjs.org/ - run: yarn install --frozen-lockfile + - run: | + git config --global user.email "bot@github.com" + git config --global user.name "Github Action" + - run: | + yarn version --new-version ${{github.ref_name}} --no-git-tag-version --no-commit-hooks - run: yarn npm publish --access public env: YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} From 72b0f73d2c4493ee14825fdcc4e496b64aa52fb2 Mon Sep 17 00:00:00 2001 From: Tomas Pilar Date: Wed, 10 Jan 2024 13:22:48 +0100 Subject: [PATCH 2/2] fixup! Signed-off-by: Tomas Pilar --- .github/workflows/npm-publish.yml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 120748d..a1c7646 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -1,5 +1,8 @@ name: Publish on Release +permissions: + contents: write + on: release: types: [created] @@ -18,11 +21,16 @@ jobs: node-version: 16 registry-url: https://registry.npmjs.org/ - run: yarn install --frozen-lockfile - - run: | + - name: Bump package.json version + run: | git config --global user.email "bot@github.com" git config --global user.name "Github Action" - - run: | - yarn version --new-version ${{github.ref_name}} --no-git-tag-version --no-commit-hooks + git tag --delete ${{github.ref_name}} + git push --delete origin ${{github.ref_name}} + git checkout -b tmp + yarn version --new-version `echo -n ${{github.ref_name}} | tr -d "v"` --no-commit-hooks + git push origin tmp:main + git push origin ${{github.ref_name}} - run: yarn npm publish --access public env: YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}