Skip to content

Commit 1728c39

Browse files
committed
fix: auto publish on tag creation
1 parent 36425ac commit 1728c39

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

.github/workflows/publish.yml

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
name: Publish to Registry 📦
22
on:
3-
workflow_dispatch:
4-
inputs:
5-
version:
6-
description: 'The updated registry version number.'
7-
required: true
3+
push:
4+
tags:
5+
- 'v*'
86

97
jobs:
108
build:
@@ -32,7 +30,12 @@ jobs:
3230
- run: yarn install --frozen-lockfile
3331
- run: yarn build
3432
- run: git stash
35-
- run: npm version ${{ github.event.inputs.version }} -m "Release ${{ github.event.inputs.version }} 📣"
33+
- name: Set version to match the tag
34+
run: |
35+
VERSION=${GITHUB_REF#refs/tags/v}
36+
npm version $VERSION -m "Release $VERSION 📣"
37+
env:
38+
GITHUB_REF: ${{ github.ref }}
3639
- run: git push
3740

3841
# Publish to npm
@@ -48,11 +51,10 @@ jobs:
4851
scope: '@jamesives'
4952

5053
- name: Authenticate with the GitHub Package Registry
51-
run:
52-
echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" >
53-
~/.npmrc
54+
run: |
55+
echo "//npm.pkg.github.com:_authToken=${{ secrets.GITHUB_TOKEN }}" > ~/.npmrc
5456
5557
# Publish to GitHub Packages
5658
- run: npm publish
5759
env:
58-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)