ci: add npm tag support for beta/next releases
This commit is contained in:
13
.github/workflows/publish.yml
vendored
13
.github/workflows/publish.yml
vendored
@@ -1,5 +1,5 @@
|
||||
name: publish
|
||||
run-name: "${{ format('release {0}', inputs.bump) }}"
|
||||
run-name: "${{ format('release {0} ({1})', inputs.bump, inputs.tag || 'latest') }}"
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
@@ -16,6 +16,15 @@ on:
|
||||
description: "Override version (optional)"
|
||||
required: false
|
||||
type: string
|
||||
tag:
|
||||
description: "npm dist-tag (latest, beta, next)"
|
||||
required: false
|
||||
type: choice
|
||||
default: "latest"
|
||||
options:
|
||||
- latest
|
||||
- beta
|
||||
- next
|
||||
|
||||
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
||||
|
||||
@@ -126,6 +135,7 @@ jobs:
|
||||
env:
|
||||
BUMP: ${{ inputs.bump }}
|
||||
VERSION: ${{ inputs.version }}
|
||||
NPM_TAG: ${{ inputs.tag || 'latest' }}
|
||||
CI: true
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_CONFIG_PROVENANCE: true
|
||||
@@ -136,6 +146,7 @@ jobs:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Merge to master
|
||||
if: inputs.tag == 'latest' || inputs.tag == ''
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
@@ -5,6 +5,7 @@ import { $ } from "bun"
|
||||
const PACKAGE_NAME = "oh-my-opencode"
|
||||
const bump = process.env.BUMP as "major" | "minor" | "patch" | undefined
|
||||
const versionOverride = process.env.VERSION
|
||||
const npmTag = process.env.NPM_TAG || "latest"
|
||||
|
||||
console.log("=== Publishing oh-my-opencode ===\n")
|
||||
|
||||
@@ -107,12 +108,11 @@ async function getContributors(previous: string): Promise<string[]> {
|
||||
}
|
||||
|
||||
async function buildAndPublish(): Promise<void> {
|
||||
console.log("\nPublishing to npm...")
|
||||
// --ignore-scripts: workflow에서 이미 빌드 완료, prepublishOnly 재실행 방지
|
||||
console.log(`\nPublishing to npm with tag: ${npmTag}...`)
|
||||
if (process.env.CI) {
|
||||
await $`npm publish --access public --provenance --ignore-scripts`
|
||||
await $`npm publish --access public --provenance --ignore-scripts --tag ${npmTag}`
|
||||
} else {
|
||||
await $`npm publish --access public --ignore-scripts`
|
||||
await $`npm publish --access public --ignore-scripts --tag ${npmTag}`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user