Skip to content

Commit

Permalink
fix: auto publish on tag creation
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves committed Jul 5, 2024
1 parent 36425ac commit 1728c39
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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 }}

0 comments on commit 1728c39

Please sign in to comment.