diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e1558f7d6..037a93795 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,8 @@ name: Publish to Registry 📦 on: - workflow_dispatch: - inputs: - version: - description: 'The updated registry version number.' - required: true + push: + tags: + - 'v*' jobs: build: @@ -32,7 +30,12 @@ jobs: - run: yarn install --frozen-lockfile - run: yarn build - run: git stash - - run: npm version ${{ github.event.inputs.version }} -m "Release ${{ github.event.inputs.version }} 📣" + - name: Set version to match the tag + run: | + VERSION=${GITHUB_REF#refs/tags/v} + npm version $VERSION -m "Release $VERSION 📣" + env: + GITHUB_REF: ${{ github.ref }} - run: git push # Publish to npm @@ -48,11 +51,10 @@ jobs: scope: '@jamesives' - name: Authenticate with the GitHub Package Registry - run: - echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" > - ~/.npmrc + run: | + echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc # Publish to GitHub Packages - run: npm publish env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file