Release @doist/twist-sdk package #12
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 @doist/twist-sdk package | |
| on: | |
| workflow_dispatch: | |
| permissions: | |
| # Enable reading repository contents (allows checkout without token) | |
| contents: read | |
| # Enable the use of OIDC for trusted publishing and npm provenance | |
| id-token: write | |
| # Enable the use of GitHub Packages registry | |
| packages: write | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| # Based on historical data | |
| timeout-minutes: 60 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: ".nvmrc" | |
| registry-url: "https://registry.npmjs.org" | |
| - name: Ensure npm 11.5.1 or later is installed | |
| run: npm install -g npm@latest | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build package | |
| run: npm run build | |
| - name: Type check | |
| run: npm run type-check | |
| - name: Lint check | |
| run: npm run lint:check | |
| - name: Format check | |
| run: npm run format:check | |
| - name: Determine npm tag | |
| id: npm-tag | |
| run: | | |
| VERSION=$(node -p "require('./package.json').version") | |
| if [[ "$VERSION" =~ (alpha|beta|rc) ]]; then | |
| echo "tag=alpha" >> $GITHUB_OUTPUT | |
| else | |
| echo "tag=latest" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Publish to npm | |
| run: npm publish --provenance --access public --tag ${{ steps.npm-tag.outputs.tag }} | |
| - name: Setup Node.js for GitHub Packages | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version-file: ".nvmrc" | |
| registry-url: "https://npm.pkg.github.com" | |
| - name: Publish to GitHub Packages | |
| run: npm publish --access public --tag ${{ steps.npm-tag.outputs.tag }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |