diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 4bb8fd5..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,6 +21,16 @@ jobs: node-version: 16 registry-url: https://registry.npmjs.org/ - run: yarn install --frozen-lockfile + - name: Bump package.json version + run: | + git config --global user.email "bot@github.com" + git config --global user.name "Github Action" + 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 }}