Skip to content

Commit 68984a6

Browse files
committed
ci: support manual release repair
1 parent a5b2c3d commit 68984a6

1 file changed

Lines changed: 51 additions & 6 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 51 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,26 @@ name: Release
33
on:
44
push:
55
branches: [main]
6+
workflow_dispatch:
7+
inputs:
8+
tag_name:
9+
description: Release tag to build and publish, for example v0.2.0
10+
required: true
11+
type: string
12+
version:
13+
description: Semver version without the v prefix, for example 0.2.0
14+
required: true
15+
type: string
16+
publish_npm:
17+
description: Publish the npm package after GitHub assets are uploaded
18+
required: true
19+
default: true
20+
type: boolean
21+
publish_skills:
22+
description: Publish skills after the release is built
23+
required: true
24+
default: true
25+
type: boolean
626

727
# One release run per commit — never cancel, just queue.
828
concurrency:
@@ -23,25 +43,45 @@ jobs:
2343
contents: write
2444
pull-requests: write
2545
outputs:
26-
release_created: ${{ steps.release.outputs.release_created }}
27-
tag_name: ${{ steps.release.outputs.tag_name }}
28-
version: ${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
46+
release_created: ${{ steps.release.outputs.release_created || steps.manual.outputs.release_created }}
47+
tag_name: ${{ steps.release.outputs.tag_name || steps.manual.outputs.tag_name }}
48+
version: ${{ steps.release.outputs.major && format('{0}.{1}.{2}', steps.release.outputs.major, steps.release.outputs.minor, steps.release.outputs.patch) || steps.manual.outputs.version }}
49+
publish_npm: ${{ steps.manual.outputs.publish_npm || 'true' }}
50+
publish_skills: ${{ steps.manual.outputs.publish_skills || steps.release.outputs.release_created }}
2951
steps:
3052
- uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4.4.1
53+
if: github.event_name != 'workflow_dispatch'
3154
id: release
3255
with:
3356
config-file: release-please-config.json
3457
manifest-file: .release-please-manifest.json
3558

59+
- name: Use manual release inputs
60+
if: github.event_name == 'workflow_dispatch'
61+
id: manual
62+
run: |
63+
{
64+
echo "release_created=true"
65+
echo "tag_name=${{ inputs.tag_name }}"
66+
echo "version=${{ inputs.version }}"
67+
echo "publish_npm=${{ inputs.publish_npm }}"
68+
echo "publish_skills=${{ inputs.publish_skills }}"
69+
} >> "$GITHUB_OUTPUT"
70+
3671
- name: Sync Cargo.lock on release PR
37-
if: steps.release.outputs.release_created != 'true'
72+
if: github.event_name != 'workflow_dispatch' && steps.release.outputs.release_created != 'true'
3873
env:
3974
GH_TOKEN: ${{ github.token }}
4075
GH_REPO: ${{ github.repository }}
4176
run: |
4277
set -euo pipefail
4378
BRANCH="release-please--branches--main--components--agent-desktop"
44-
if ! gh pr view "$BRANCH" --json number >/dev/null 2>&1; then
79+
OPEN_RELEASE_PRS=$(gh pr list \
80+
--head "$BRANCH" \
81+
--state open \
82+
--json number \
83+
--jq 'length')
84+
if [ "$OPEN_RELEASE_PRS" = "0" ]; then
4585
echo "No open release PR branch to sync"
4686
exit 0
4787
fi
@@ -278,6 +318,10 @@ jobs:
278318
GH_TOKEN: ${{ github.token }}
279319
GH_REPO: ${{ github.repository }}
280320
run: |
321+
gh release view ${{ needs.release-please.outputs.tag_name }} >/dev/null 2>&1 \
322+
|| gh release create ${{ needs.release-please.outputs.tag_name }} \
323+
--title ${{ needs.release-please.outputs.tag_name }} \
324+
--notes "Release ${{ needs.release-please.outputs.tag_name }}"
281325
gh release upload ${{ needs.release-please.outputs.tag_name }} \
282326
./*.tar.gz ./*.zip checksums.txt \
283327
--clobber
@@ -295,6 +339,7 @@ jobs:
295339
publish-npm:
296340
name: Publish to npm
297341
needs: [release-please, publish-github]
342+
if: needs.release-please.outputs.release_created == 'true' && needs.release-please.outputs.publish_npm == 'true'
298343
runs-on: ubuntu-latest
299344
timeout-minutes: 15
300345
permissions:
@@ -344,7 +389,7 @@ jobs:
344389
publish-skills:
345390
name: Publish Skills to ClawHub
346391
needs: [release-please]
347-
if: needs.release-please.outputs.release_created == 'true'
392+
if: needs.release-please.outputs.release_created == 'true' && needs.release-please.outputs.publish_skills == 'true'
348393
runs-on: ubuntu-latest
349394
timeout-minutes: 10
350395
permissions:

0 commit comments

Comments
 (0)