diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7bc8dee..07cef97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,6 +1,3 @@ -# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created -# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages - name: NPM Publish on: @@ -9,7 +6,7 @@ on: permissions: id-token: write # Required for OIDC - contents: read + contents: write # Required to push version bump commit jobs: publish-npm: @@ -23,5 +20,16 @@ jobs: - run: npm install -g npm@latest - run: npm ci --ignore-scripts --no-audit --no-fund - run: npm test + - name: Bump version in package.json + run: | + VERSION="${{ github.event.release.tag_name }}" + npm version "${VERSION#v}" --no-git-tag-version + - name: Commit and push version bump + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add package.json package-lock.json + git commit -m "chore: bump version to ${{ github.event.release.tag_name }}" + git push origin HEAD:main - run: npm run build - run: npm publish --access public