chore(release): 1.0.0-beta.2 #27
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 @spawn-dock/dev-tunnel | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - "v*" | |
| branches: | |
| - main | |
| concurrency: | |
| group: publish-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true | |
| jobs: | |
| check: | |
| uses: ./.github/workflows/check.yml | |
| publish: | |
| needs: check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.12.0 | |
| registry-url: https://registry.npmjs.org | |
| - name: Verify npm auth secret | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_KEY }} | |
| run: | | |
| if [[ -z "${NODE_AUTH_TOKEN}" ]]; then | |
| echo "Missing npm auth. Set repository secret NPM_KEY." >&2 | |
| exit 1 | |
| fi | |
| - run: npm ci | |
| - name: Determine version type | |
| id: version | |
| run: | | |
| if [[ "${{ github.ref }}" == refs/tags/v* ]]; then | |
| echo "type=release" >> "$GITHUB_OUTPUT" | |
| VERSION="${{ github.ref_name }}" | |
| VERSION="${VERSION#v}" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| else | |
| SHORT_SHA="${GITHUB_SHA::7}" | |
| TIMESTAMP="$(date +%Y%m%d%H%M%S)" | |
| CURRENT=$(node -p "require('./package.json').version") | |
| CANARY="${CURRENT}-canary.${TIMESTAMP}.${SHORT_SHA}" | |
| echo "type=canary" >> "$GITHUB_OUTPUT" | |
| echo "version=$CANARY" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Set package version | |
| run: npm version "${{ steps.version.outputs.version }}" --no-git-tag-version --allow-same-version | |
| - run: npm run build | |
| - name: Publish release (stable or prerelease) | |
| if: steps.version.outputs.type == 'release' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_KEY }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| if [[ "$VERSION" == *-* ]]; then | |
| npm publish --access public --tag beta | |
| else | |
| npm publish --access public | |
| fi | |
| - name: Publish canary | |
| if: steps.version.outputs.type == 'canary' | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_KEY }} | |
| run: npm publish --access public --tag canary |