From 0818b2e1aec8b3b2363bc604752e2bb5b66358a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Teles?= Date: Fri, 17 May 2024 22:15:40 -0300 Subject: [PATCH] chore: Update GitHub Actions workflow for releasing and publishing package --- .github/workflows/publish.yml | 80 +++++++++++++++++------------------ 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 42b3d74..6de2adb 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,43 +1,43 @@ name: Release and Publish Package on: - push: - branches: - - main + push: + branches: + - main jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Setup Node.js - uses: actions/setup-node@v2 - with: - node-version: '14' - registry-url: 'https://registry.npmjs.org' - - name: Install dependencies - run: npm ci - - name: Build - run: npm run build - - name: Bump version and create a git tag - id: bump_version - run: | - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - npm version patch -m "Bump version to %s [skip ci]" - echo ::set-output name=VERSION::$(node -p "require('./package.json').version") - - name: Push changes - run: git push --follow-tags - - name: Create Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.bump_version.outputs.VERSION }} - release_name: Release ${{ steps.bump_version.outputs.VERSION }} - draft: false - prerelease: false - - name: Publish to npm - run: npm publish - env: - NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} \ No newline at end of file + release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + registry-url: 'https://registry.npmjs.org' + - name: Install dependencies + run: npm ci + - name: Build + run: npm run build + - name: Bump version and create a git tag + id: bump_version + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + npm version patch -m "Bump version to %s [skip ci]" + echo ::set-output name=VERSION::$(node -p "require('./package.json').version") + - name: Push changes + run: git push --follow-tags + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.bump_version.outputs.VERSION }} + release_name: Release ${{ steps.bump_version.outputs.VERSION }} + draft: false + prerelease: false + - name: Publish to npm + run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN }} \ No newline at end of file