-
Notifications
You must be signed in to change notification settings - Fork 14
46 lines (40 loc) · 1.32 KB
/
publish.yml
File metadata and controls
46 lines (40 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Publish NPM Package
on:
release:
types:
- published
workflow_dispatch:
jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Setup
uses: ./.github/actions/setup
- name: Determine NPM tag
id: npm-tag
run: |
# Read the version from package.json
VERSION=$(node -p "require('./modules/@shopify/checkout-sheet-kit/package.json').version")
# Check if it's a "beta" or "rc" version
if [[ "$VERSION" == *"-beta"* ]] || [[ "$VERSION" == *"-rc"* ]]; then
echo "Version $VERSION is a prerelease, using 'next' tag"
echo "tag=next" >> $GITHUB_OUTPUT
else
echo "Version $VERSION is a stable release, using 'latest' tag"
echo "tag=latest" >> $GITHUB_OUTPUT
fi
- name: Prepare release
run: |
cp README.md modules/@shopify/checkout-sheet-kit
pnpm module clean
pnpm module build
cd modules/@shopify/checkout-sheet-kit
npm publish --access public --tag ${{ steps.npm-tag.outputs.tag }}
env:
NPM_TOKEN: '' # Empty string forces OIDC