Publish NPM Package #54
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
| - name: Setup | |
| uses: ./.github/actions/setup | |
| - name: Debug versions | |
| run: | | |
| node --version | |
| npm --version | |
| - 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 | |
| yarn module clean | |
| yarn 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 |