diff --git a/.github/workflows/release-and-publish.yaml b/.github/workflows/release-and-publish.yaml index c47fe3f..7112337 100644 --- a/.github/workflows/release-and-publish.yaml +++ b/.github/workflows/release-and-publish.yaml @@ -30,6 +30,9 @@ jobs: release: needs: build runs-on: ubuntu-latest + outputs: + new_release_published: ${{ steps.semantic.outputs.new_release_published }} + new_release_version: ${{ steps.semantic.outputs.new_release_version }} steps: - uses: actions/checkout@v3 with: @@ -39,20 +42,24 @@ jobs: node-version: 20 - run: npm ci - name: Semantic Release + id: semantic env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npx semantic-release - publish: - needs: release - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 20 - registry-url: https://registry.npmjs.org/ - - run: npm publish --access public - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} \ No newline at end of file + publish: + needs: release + if: needs.release.outputs.new_release_published == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - run: npm ci + - run: npm version ${{ needs.release.outputs.new_release_version }} --no-git-tag-version + - run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} \ No newline at end of file