Skip to content

fix: allow manual release from main without a tag #31

fix: allow manual release from main without a tag

fix: allow manual release from main without a tag #31

Workflow file for this run

name: Release
on:
push:
branches:
- main
- stable
workflow_dispatch:
inputs:
tag:
description: 'Tag to publish (e.g., v0.2.1). Leave empty for normal release-please flow.'
required: false
type: string
jobs:
release-please:
if: github.event_name == 'push'
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs['packages/core--release_created'] }}
tag_name: ${{ steps.release.outputs['packages/core--tag_name'] }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
publish:
needs: release-please
if: needs.release-please.outputs.release_created == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Publish
working-directory: packages/core
run: |
npm install -g npm@latest
npm publish --provenance --access public
publish-manual:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.tag || github.ref }}
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Publish
working-directory: packages/core
run: |
npm install -g npm@latest
npm publish --provenance --access public
publish-canary:
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build
run: bun run build
- name: Set canary version
working-directory: packages/core
run: |
CURRENT=$(jq -r .version package.json)
BASE=${CURRENT%%-*}
CANARY="${BASE}-canary.$(git rev-list --count HEAD)"
jq --arg v "$CANARY" '.version = $v' package.json > tmp.json && mv tmp.json package.json
echo "Publishing $CANARY"
- name: Publish canary
working-directory: packages/core
run: |
npm install -g npm@latest
npm publish --provenance --access public --tag canary