v0.1.0-alpha.4 #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: Release @doist/twist-sdk package | |
| on: | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| # Enable the use of OIDC for npm provenance | |
| contents: read | |
| id-token: write | |
| # Enable writing packages to GitHub Packages | |
| packages: write | |
| jobs: | |
| publish: | |
| # Only run if a release was published or workflow was manually triggered | |
| if: ${{ github.event.action == 'published' || github.event_name == 'workflow_dispatch' }} | |
| 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: 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 }} | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
| - 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 }} |