v0.0.1-beta.6 #6
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 Workflow | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| publisher: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '24.18.0' | |
| registry-url: 'https://registry.npmjs.org/' | |
| scope: '@mathcovax' | |
| - env: | |
| RELEASE_TAG: ${{ github.event.release.tag_name }} | |
| PRERELEASE: ${{ github.event.release.prerelease }} | |
| run: | | |
| VERSION=$(echo "$RELEASE_TAG" | sed -nE 's/^v([^[:space:]]+)$/\1/p') | |
| if [ -z "$VERSION" ]; then | |
| echo "::error::Invalid release tag: $RELEASE_TAG" | |
| exit 1 | |
| fi | |
| if [[ "$VERSION" =~ -beta([.-]|$) ]]; then | |
| HAS_BETA=true | |
| else | |
| HAS_BETA=false | |
| fi | |
| if [ "$PRERELEASE" != "$HAS_BETA" ]; then | |
| echo "::error::Incoherent release: prerelease=$PRERELEASE, version=$VERSION" | |
| exit 1 | |
| fi | |
| sed -i "s/\"version\": *\"[^\"]*\"/\"version\": \"${VERSION}\"/" package.json | |
| - run: npm install -g npm@latest | |
| - run: npm ci | |
| - run: npm run build | |
| - run: npm run test:types | |
| - env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| PRERELEASE: ${{ github.event.release.prerelease }} | |
| run: | | |
| if [ "$PRERELEASE" = "true" ]; then | |
| npm stage publish --tag beta --access public | |
| else | |
| npm stage publish --access public | |
| fi | |