Merge pull request #17 from better-stack-ai/feat/define-routes #21
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: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Update npm | |
| run: npm install -g npm@latest | |
| - run: pnpm install | |
| - name: Build | |
| run: pnpm build | |
| - name: Determine npm tag | |
| id: determine_npm_tag | |
| shell: bash | |
| run: | | |
| TAG="${GITHUB_REF#refs/tags/}" | |
| if [[ "$TAG" =~ -(next|canary|beta|rc) ]]; then | |
| NPM_TAG=${BASH_REMATCH[1]} | |
| else | |
| git fetch origin main | |
| if git merge-base --is-ancestor "$GITHUB_SHA" origin/main; then | |
| NPM_TAG="latest" | |
| else | |
| echo "The tagged commit is not on the main branch." | |
| echo "::error ::Releases with the 'latest' npm tag must be on the main branch." | |
| exit 1 | |
| fi | |
| fi | |
| echo "npm_tag=$NPM_TAG" >> $GITHUB_OUTPUT | |
| echo "Using npm tag: $NPM_TAG" | |
| - name: Publish to npm | |
| run: npm publish --access public --provenance --tag ${{ steps.determine_npm_tag.outputs.npm_tag }} |