Skip to content

Commit 0d25900

Browse files
authored
Publish package with "next" tag if prerelease version (#291)
* Allow publish from release-candidate branch, tag releases with @next * Change branch name to next * Read package version
1 parent 4c5b94c commit 0d25900

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

.github/workflows/publish.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,28 @@ jobs:
1717
- name: Setup
1818
uses: ./.github/actions/setup
1919

20+
- name: Determine NPM tag
21+
id: npm-tag
22+
run: |
23+
# Read the version from package.json
24+
VERSION=$(node -p "require('./modules/@shopify/checkout-sheet-kit/package.json').version")
25+
26+
# Check if it's a "beta" or "rc" version
27+
if [[ "$VERSION" == *"-beta"* ]] || [[ "$VERSION" == *"-rc"* ]]; then
28+
echo "Version $VERSION is a prerelease, using 'next' tag"
29+
echo "tag=next" >> $GITHUB_OUTPUT
30+
else
31+
echo "Version $VERSION is a stable release, using 'latest' tag"
32+
echo "tag=latest" >> $GITHUB_OUTPUT
33+
fi
34+
2035
- name: Prepare release
2136
run: |
2237
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
2338
cp README.md modules/@shopify/checkout-sheet-kit
2439
yarn module clean
2540
yarn module build
2641
cd modules/@shopify/checkout-sheet-kit
27-
npm publish --access public
42+
npm publish --access public --tag ${{ steps.npm-tag.outputs.tag }}
2843
env:
2944
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)