diff --git a/.github/workflows/test-and-deplyo.yml b/.github/workflows/test-and-deploy.yml similarity index 57% rename from .github/workflows/test-and-deplyo.yml rename to .github/workflows/test-and-deploy.yml index 1e090948..d09bd05f 100644 --- a/.github/workflows/test-and-deplyo.yml +++ b/.github/workflows/test-and-deploy.yml @@ -3,7 +3,7 @@ on: push permissions: id-token: write # Required for OIDC - contents: read + contents: write # Required for creating releases and tags jobs: test: @@ -49,3 +49,23 @@ jobs: - run: npm install - name: Publish the library. run: npm publish $DIST_FOLDER + + create_release: + if: github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + needs: + - publish_to_npm + steps: + - uses: actions/checkout@v3.3.0 + - name: Get version from package.json + id: version + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + - name: Create tag and release + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git tag v${{ steps.version.outputs.version }} + git push origin v${{ steps.version.outputs.version }} + gh release create v${{ steps.version.outputs.version }} --generate-notes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}