docs: fix toc scrolling #63
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 canary release | ||
Check failure on line 1 in .github/workflows/publish-canary-release.yaml
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
package: | ||
description: "Which package(s) to release" | ||
type: choice | ||
options: [filters, action-menu, both] | ||
required: true | ||
bump_type: | ||
description: "Bump type" | ||
type: choice | ||
options: [patch, minor, major] | ||
default: patch | ||
npm_tag: | ||
description: "npm dist-tag" | ||
type: choice | ||
options: [canary, latest] | ||
default: canary | ||
dry_run: | ||
description: "Run in dry-run mode (no publish or git push)" | ||
type: boolean | ||
default: false | ||
jobs: | ||
publish-canary: | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-24.04 | ||
# serialize matrix to avoid concurrent commits/tags racing | ||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
package: [filters, action-menu] | ||
# Skip matrix rows not selected by input | ||
if: > | ||
github.event_name == 'pull_request' || | ||
inputs.package == 'both' || | ||
(inputs.package == 'filters' && matrix.package == 'filters') || | ||
(inputs.package == 'action-menu' && matrix.package == 'action-menu') | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
fetch-depth: 0 | ||
- name: Configure Git | ||
run: | | ||
git config user.name "${{ github.actor }}" | ||
git config user.email "${{ github.actor }}@users.noreply.github.com" | ||
- name: Setup Bun | ||
uses: oven-sh/setup-bun@v2 | ||
with: | ||
bun-version-file: "package.json" | ||
- name: Setup Node.js for npm | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version-file: "package.json" | ||
- name: Install dependencies | ||
run: bun i --frozen-lockfile | ||
- name: Set up .npmrc for authentication | ||
if: github.event_name != 'pull_request' && !inputs.dry_run | ||
run: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc | ||
env: | ||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
- name: Build & release ${{ matrix.package }} | ||
working-directory: packages/${{ matrix.package }} | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
run: | | ||
# build (your publish.ts runs tests again as well) | ||
bun run build | ||
# Decide flags based on event + dry_run | ||
EXTRA_FLAGS="--no-git-tag --tag ${{ inputs.npm_tag }}" | ||
if [[ "${{ github.event_name }}" == "pull_request" || "${{ inputs.dry_run }}" == "true" ]]; then | ||
EXTRA_FLAGS="$EXTRA_FLAGS --dry-run" | ||
fi | ||
# Call your release script directly (uses your custom versioning) | ||
bun scripts/release.ts --bump ${{ inputs.bump_type }} --path . $EXTRA_FLAGS | ||
- name: Commit version bump for ${{ matrix.package }} | ||
if: github.event_name != 'pull_request' && !inputs.dry_run | ||
working-directory: packages/${{ matrix.package }} | ||
run: | | ||
PKG_NAME=$(jq -r '.name' package.json) | ||
NEXT_VERSION=$(jq -r '.version' package.json) | ||
git add package.json | ||
git commit -m "release(${PKG_NAME}): v${NEXT_VERSION}" | ||
- name: Create per-package tag for ${{ matrix.package }} | ||
if: github.event_name != 'pull_request' && !inputs.dry_run | ||
working-directory: packages/${{ matrix.package }} | ||
run: | | ||
PKG_NAME=$(jq -r '.name' package.json) | ||
NEXT_VERSION=$(jq -r '.version' package.json) | ||
# Sanitize tag so it doesn't contain '/' | ||
TAG_NAME="${PKG_NAME}@${NEXT_VERSION}" | ||
git tag "$TAG_NAME" | ||
git push origin "$TAG_NAME" | ||
- name: Push branch (after commit) | ||
if: github.event_name != 'pull_request' && !inputs.dry_run | ||
run: | | ||
git push origin HEAD |