Skip to content

chore(main): release 0.3.6 (#49) #61

chore(main): release 0.3.6 (#49)

chore(main): release 0.3.6 (#49) #61

Workflow file for this run

name: Release
on:
push:
branches: [main]
workflow_dispatch:
inputs:
tag:
description: Existing GitHub Release tag to resume (for example, v0.4.0-beta.1)
required: true
type: string
version:
description: Exact package version contained in the tag
required: true
type: string
npm-dist-tag:
description: Explicit npm channel (latest for stable, or next/beta/etc. for prereleases)
required: true
type: string
concurrency:
group: release-${{ inputs.tag || github.ref }}
cancel-in-progress: false
permissions:
contents: read
jobs:
release-please:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
pull-requests: write
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
version: ${{ steps.release.outputs.version }}
steps:
- uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4
if: github.event_name == 'push'
id: release
with:
token: ${{ secrets.GITHUB_TOKEN }}
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
target-branch: main
release-context:
needs: release-please
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
should-publish: ${{ steps.validate.outputs.should-publish }}
tag-name: ${{ steps.validate.outputs.tag-name }}
version: ${{ steps.validate.outputs.version }}
npm-dist-tag: ${{ steps.validate.outputs.npm-dist-tag }}
steps:
- name: Validate the release to publish
id: validate
env:
EVENT_NAME: ${{ github.event_name }}
AUTO_RELEASE_CREATED: ${{ needs.release-please.outputs.release_created }}
AUTO_TAG_NAME: ${{ needs.release-please.outputs.tag_name }}
AUTO_VERSION: ${{ needs.release-please.outputs.version }}
INPUT_TAG_NAME: ${{ inputs.tag }}
INPUT_VERSION: ${{ inputs.version }}
INPUT_NPM_DIST_TAG: ${{ inputs['npm-dist-tag'] }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
shell: bash
run: |
set -euo pipefail
if [[ "$EVENT_NAME" == push ]]; then
if [[ "$AUTO_RELEASE_CREATED" != true ]]; then
echo "should-publish=false" >> "$GITHUB_OUTPUT"
exit 0
fi
tag_name=$AUTO_TAG_NAME
version=$AUTO_VERSION
npm_dist_tag=latest
version_pattern='^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$'
else
tag_name=$INPUT_TAG_NAME
version=$INPUT_VERSION
npm_dist_tag=$INPUT_NPM_DIST_TAG
prerelease_identifier='(0|[1-9][0-9]*|[0-9A-Za-z-]*[A-Za-z-][0-9A-Za-z-]*)'
build_identifier='[0-9A-Za-z-]+'
version_pattern="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-$prerelease_identifier(\.$prerelease_identifier)*)?(\+$build_identifier(\.$build_identifier)*)?$"
fi
if [[ ! "$version" =~ $version_pattern ]]; then
echo "version is not allowed for this release mode: $version" >&2
exit 1
fi
if [[ "$tag_name" != "v$version" ]]; then
echo "tag must exactly match v<version>: tag=$tag_name version=$version" >&2
exit 1
fi
if [[ "$EVENT_NAME" == workflow_dispatch ]]; then
if [[ ! "$npm_dist_tag" =~ ^[a-z][a-z0-9._-]*$ ]]; then
echo "npm-dist-tag must be an explicit lowercase channel, got: $npm_dist_tag" >&2
exit 1
fi
if [[ "${version%%+*}" == *-* && "$npm_dist_tag" == latest ]]; then
echo "prereleases must use an explicit npm channel other than latest" >&2
exit 1
fi
release_tag=$(gh release view "$tag_name" --repo "$GH_REPO" --json tagName --jq '.tagName')
if [[ "$release_tag" != "$tag_name" ]]; then
echo "GitHub Release tag mismatch: expected $tag_name, got $release_tag" >&2
exit 1
fi
gh api --silent "repos/$GH_REPO/git/ref/tags/$tag_name"
fi
{
echo "should-publish=true"
echo "tag-name=$tag_name"
echo "version=$version"
echo "npm-dist-tag=$npm_dist_tag"
} >> "$GITHUB_OUTPUT"
package-smoke:
needs: release-context
if: needs.release-context.outputs.should-publish == 'true'
permissions:
contents: read
uses: ./.github/workflows/publish-test.yml
with:
checkout-ref: ${{ needs.release-context.outputs.tag-name }}
expected-version: ${{ needs.release-context.outputs.version }}
publish-crates:
needs: [release-context, package-smoke]
if: needs.package-smoke.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
ref: ${{ needs.release-context.outputs.tag-name }}
path: release-source
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: release-crates
path: artifacts/crates
- name: Install Rust
run: rustup toolchain install 1.87.0 --profile minimal
- name: Publish packaged crates if absent
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
RELEASE_VERSION: ${{ needs.release-context.outputs.version }}
run: tools/release/publish-crates.sh artifacts/crates "$RELEASE_VERSION" release-source
publish-nodejs:
needs: [release-context, package-smoke]
if: needs.package-smoke.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: release-node-packages
path: artifacts/node
- name: Publish platform packages, then the main package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_DIST_TAG: ${{ needs.release-context.outputs.npm-dist-tag }}
run: tools/release/publish-npm.sh artifacts/node "$NPM_DIST_TAG"
publish-wasm:
needs: [release-context, package-smoke]
if: needs.package-smoke.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
node-version: 20
registry-url: https://registry.npmjs.org
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: release-wasm-package
path: artifacts/wasm
- name: Publish the tested web package
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_DIST_TAG: ${{ needs.release-context.outputs.npm-dist-tag }}
run: tools/release/publish-npm.sh artifacts/wasm "$NPM_DIST_TAG"
publish-python:
needs: [release-context, package-smoke]
if: needs.package-smoke.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 15
environment: pypi
permissions:
contents: read
id-token: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: artifacts/python
pattern: release-python-*
merge-multiple: true
- uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1
with:
command: upload
maturin-version: v1.9.4
args: --non-interactive --skip-existing artifacts/python/*
publish-ffi:
needs: [release-context, package-smoke]
if: needs.package-smoke.result == 'success'
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: write
steps:
- uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
path: artifacts/ffi
pattern: release-ffi-*
merge-multiple: true
- name: Attach the tested archives to the GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_REPO: ${{ github.repository }}
TAG_NAME: ${{ needs.release-context.outputs.tag-name }}
run: gh release upload "$TAG_NAME" artifacts/ffi/*.tar.gz --clobber --repo "$GH_REPO"