Skip to content

2.11.3

2.11.3 #76

Workflow file for this run

name: BTST Release
on:
release:
types: [published]
permissions:
contents: write
id-token: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
with:
version: 10.17.1
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
with:
node-version: 22.22.1
registry-url: 'https://registry.npmjs.org'
- name: Update npm
run: npm install -g npm@latest
- run: pnpm install
- name: Copy README files to published packages
run: |
cp README.md packages/stack/README.md
cp README.md packages/cli/README.md
- name: Typecheck @btst/stack
working-directory: packages/stack
run: pnpm typecheck
- name: Typecheck @btst/codegen
working-directory: packages/cli
run: pnpm typecheck
- name: Build @btst/stack
run: pnpm --filter "@btst/stack" build --force
- name: Build @btst/codegen
run: pnpm --filter "@btst/codegen" build --force
- name: Verify tag matches package version
working-directory: packages/stack
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
if [ -n "${{ github.event.release.tag_name }}" ]; then
RAW_TAG="${{ github.event.release.tag_name }}"
else
RAW_TAG="${GITHUB_REF#refs/tags/}"
fi
TAG_VERSION="${RAW_TAG#v}"
if [ "$PKG_VERSION" != "$TAG_VERSION" ]; then
echo "Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)"
exit 1
fi
- name: Publish to npm
working-directory: packages/stack
run: npm publish --access public --provenance
- name: Publish @btst/codegen to npm
working-directory: packages/cli
run: |
PKG_VERSION=$(node -p "require('./package.json').version")
if npm view "@btst/codegen@$PKG_VERSION" version >/dev/null 2>&1; then
echo "@btst/codegen@$PKG_VERSION is already published; skipping."
exit 0
fi
npm publish --access public --provenance
- name: Upload npm logs on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: npm-debug-logs
path: /home/runner/.npm/_logs/
retention-days: 7