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