Merge pull request #39 from SimplyLiz/develop #9
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 | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| registry-url: https://registry.npmjs.org | |
| - run: pnpm install --frozen-lockfile | |
| - run: pnpm build | |
| - run: pnpm test:coverage | |
| - run: pnpm lint | |
| - run: pnpm format:check | |
| - name: Verify dist artifacts exist | |
| run: | | |
| for pkg in types probe storage middleware-express middleware-fastify middleware-hono middleware-koa; do | |
| if ! ls packages/$pkg/dist/*.js &>/dev/null || ! ls packages/$pkg/dist/*.d.ts &>/dev/null; then | |
| echo "Missing dist artifacts in packages/$pkg" | |
| exit 1 | |
| fi | |
| done | |
| - name: Validate version matches tag | |
| run: | | |
| TAG_VERSION="${GITHUB_REF_NAME#v}" | |
| PKG_VERSION=$(node -p "require('./package.json').version") | |
| if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then | |
| echo "Tag version ($TAG_VERSION) does not match package.json version ($PKG_VERSION)" | |
| exit 1 | |
| fi | |
| - run: pnpm -r publish --no-git-checks --access public --provenance | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Extract release notes from changelog | |
| id: release-notes | |
| uses: ffurrer2/extract-release-notes@v3 | |
| - uses: softprops/action-gh-release@v2 | |
| with: | |
| body: ${{ steps.release-notes.outputs.release_notes }} |