diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index d97f773..2aaba48 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -40,13 +40,34 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - uses: actions/setup-node@v3 with: node-version: '20.x' registry-url: 'https://registry.npmjs.org' + - name: Configure Git + run: | + git config user.name github-actions + git config user.email github-actions@github.com - run: npm ci - - name: Set version to release tag - run: npm version ${{ github.event.release.tag_name }} --no-git-tag-version + - name: Update version and commit + run: | + npm version ${{ github.event.release.tag_name }} --no-git-tag-version + git add package.json package-lock.json + git commit -m "Bump version to ${{ github.event.release.tag_name }}" + git push - run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} + - name: Update release notes + uses: actions/github-script@v6 + with: + github-token: ${{secrets.GITHUB_TOKEN}} + script: | + github.rest.repos.updateRelease({ + owner: context.repo.owner, + repo: context.repo.repo, + release_id: context.payload.release.id, + body: context.payload.release.body + '\n\nThis release has been published to npm.' + })