ci: publish from release events (#628)

This commit is contained in:
Kevin Codex
2026-04-13 00:33:43 +08:00
committed by GitHub
parent fa4b6a96c0
commit 41a86d05fa

View File

@@ -4,12 +4,9 @@ on:
push: push:
branches: branches:
- main - main
workflow_dispatch: release:
inputs: types:
tag_name: - published
description: Existing tag to publish, for example v0.2.0
required: true
type: string
concurrency: concurrency:
group: auto-release-${{ github.ref }} group: auto-release-${{ github.ref }}
@@ -18,6 +15,7 @@ concurrency:
jobs: jobs:
release-please: release-please:
name: Release Please name: Release Please
if: ${{ github.event_name == 'push' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: permissions:
contents: write contents: write
@@ -36,8 +34,7 @@ jobs:
publish-npm: publish-npm:
name: Publish to npm name: Publish to npm
needs: release-please if: ${{ github.event_name == 'release' }}
if: ${{ github.event_name == 'workflow_dispatch' || needs.release-please.outputs.release_created == 'true' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
environment: release environment: release
permissions: permissions:
@@ -47,7 +44,7 @@ jobs:
- name: Checkout release tag - name: Checkout release tag
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
with: with:
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag_name || needs.release-please.outputs.tag_name }} ref: ${{ github.event.release.tag_name }}
fetch-depth: 0 fetch-depth: 0
- name: Set up Node.js - name: Set up Node.js
@@ -87,8 +84,8 @@ jobs:
- name: Release summary - name: Release summary
run: | run: |
{ {
echo "## Released ${{ needs.release-please.outputs.tag_name }}" echo "## Released ${{ github.event.release.tag_name }}"
echo echo
echo "- npm: https://www.npmjs.com/package/@gitlawb/openclaude" echo "- npm: https://www.npmjs.com/package/@gitlawb/openclaude"
echo "- GitHub: https://github.com/Gitlawb/openclaude/releases/tag/${{ needs.release-please.outputs.tag_name }}" echo "- GitHub: https://github.com/Gitlawb/openclaude/releases/tag/${{ github.event.release.tag_name }}"
} >> "$GITHUB_STEP_SUMMARY" } >> "$GITHUB_STEP_SUMMARY"