diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fa7d9fd7..4be1d8cd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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" diff --git a/script/publish.ts b/script/publish.ts index ba7e33dc..97008e81 100644 --- a/script/publish.ts +++ b/script/publish.ts @@ -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 { } async function buildAndPublish(): Promise { - 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}` } }