v6.0.0-beta.1 #49
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 on tag | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| id-token: write | |
| contents: write | |
| jobs: | |
| build-native: | |
| strategy: | |
| matrix: | |
| platform: | |
| # The x86_64 Linux prebuild is generated when running pnpm turbo run build in the `build` job | |
| - runs-on: codspeedhq-arm64-ubuntu-22.04 | |
| name: linux-arm | |
| - runs-on: macos-latest | |
| name: darwin-arm | |
| runs-on: ${{ matrix.platform.runs-on }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| cache: pnpm | |
| node-version-file: .nvmrc | |
| - run: pnpm install --frozen-lockfile --prefer-offline | |
| - name: Build native addon | |
| run: pnpm turbo run build-native-addon --filter=@codspeed/core | |
| - name: Upload prebuilds | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.platform.name }}-prebuilds | |
| path: packages/core/prebuilds | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: build-native | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - uses: pnpm/action-setup@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| cache: pnpm | |
| node-version-file: .nvmrc | |
| registry-url: "https://registry.npmjs.org" | |
| - run: pnpm install --frozen-lockfile --prefer-offline | |
| - name: Build the libraries | |
| run: pnpm turbo run build | |
| - name: Download prebuilds | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: "*-prebuilds" | |
| merge-multiple: true | |
| path: packages/core/prebuilds | |
| - if: github.event_name == 'push' | |
| name: Publish the libraries | |
| run: | | |
| # Prerelease tags publish under their own identifier (alpha, beta, rc); | |
| # only a plain vX.Y.Z tag is allowed to move the `latest` dist-tag. | |
| VERSION="${GITHUB_REF_NAME#v}" | |
| if [[ "$VERSION" != *-* ]]; then | |
| pnpm publish -r --access=public --no-git-checks | |
| exit 0 | |
| fi | |
| PREID="${VERSION#*-}" | |
| PREID="${PREID%%.*}" | |
| # npm rejects a dist-tag that parses as a semver range, so a numeric | |
| # identifier has no channel to publish under, and `latest` is the | |
| # stable channel a prerelease must never take over. | |
| if [[ ! "$PREID" =~ ^[A-Za-z][A-Za-z0-9-]*$ || "${PREID,,}" == "latest" ]]; then | |
| echo "Refusing to publish $GITHUB_REF_NAME: '$PREID' cannot be a prerelease dist-tag" >&2 | |
| exit 1 | |
| fi | |
| pnpm publish -r --access=public --no-git-checks --tag="$PREID" | |
| env: | |
| NPM_CONFIG_PROVENANCE: true | |
| # Surfaces npm's OIDC token exchange, which is otherwise silent. | |
| NPM_CONFIG_LOGLEVEL: verbose | |
| - if: github.event_name == 'push' | |
| name: Create a draft release | |
| run: | | |
| NEW_VERSION=$(pnpm lerna list --json | jq -r '.[] | select(.name == "@codspeed/core") | .version') | |
| PRERELEASE="" | |
| if [[ "$NEW_VERSION" == *-* ]]; then | |
| PRERELEASE="--prerelease" | |
| fi | |
| gh release create "v$NEW_VERSION" --title "v$NEW_VERSION" --generate-notes -d $PRERELEASE | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |