Skip to content

Commit 974ff14

Browse files
authored
fix: add workflow_dispatch trigger to release-please workflow (#52)
1 parent badf099 commit 974ff14

3 files changed

Lines changed: 39 additions & 8 deletions

File tree

.github/workflows/cherry-pick-to-release.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414

1515
permissions:
1616
contents: write
17+
actions: write
1718

1819
jobs:
1920
cherry-pick:
@@ -38,4 +39,12 @@ jobs:
3839
run: |
3940
git push origin release/v${{ inputs.version }}
4041
echo "Successfully cherry-picked commit to release/v${{ inputs.version }}"
41-
echo "Release-please will update the CHANGELOG PR automatically."
42+
43+
- name: Trigger Release Please
44+
env:
45+
GH_TOKEN: ${{ github.token }}
46+
run: |
47+
gh workflow run release-please.yml \
48+
--repo ${{ github.repository }} \
49+
-f version=${{ inputs.version }}
50+
echo "Triggered Release Please workflow for version ${{ inputs.version }}"

.github/workflows/cut-release-branch.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414

1515
permissions:
1616
contents: write
17+
actions: write
1718

1819
jobs:
1920
cut-branch:
@@ -58,3 +59,12 @@ jobs:
5859
5960
git commit -m "$COMMIT_MSG"
6061
git push origin "release/v${{ inputs.version }}"
62+
63+
- name: Trigger Release Please
64+
env:
65+
GH_TOKEN: ${{ github.token }}
66+
run: |
67+
gh workflow run release-please.yml \
68+
--repo ${{ github.repository }} \
69+
-f version=${{ inputs.version }}
70+
echo "Triggered Release Please workflow for version ${{ inputs.version }}"

.github/workflows/release-please.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ on:
44
push:
55
branches:
66
- 'release/**'
7+
workflow_dispatch:
8+
inputs:
9+
version:
10+
description: 'Release version (e.g., 0.3.0)'
11+
required: true
12+
type: string
713

814
permissions:
915
contents: write
@@ -13,18 +19,24 @@ jobs:
1319
release-please:
1420
runs-on: ubuntu-latest
1521
steps:
16-
- name: Extract version from branch name
17-
id: extract-version
22+
- name: Determine version
23+
id: version
1824
run: |
19-
# Branch name is like "release/v0.3.0", extract "0.3.0"
20-
VERSION="${GITHUB_REF_NAME#release/v}"
25+
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
26+
VERSION="${{ inputs.version }}"
27+
BRANCH="release/v${{ inputs.version }}"
28+
else
29+
VERSION="${GITHUB_REF_NAME#release/v}"
30+
BRANCH="${GITHUB_REF_NAME}"
31+
fi
2132
echo "version=$VERSION" >> $GITHUB_OUTPUT
22-
echo "Extracted version: $VERSION"
33+
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
34+
echo "Version: $VERSION, Branch: $BRANCH"
2335
2436
- uses: googleapis/release-please-action@v4
2537
id: release
2638
with:
2739
config-file: .github/release-please-config.json
2840
manifest-file: .github/.release-please-manifest.json
29-
target-branch: ${{ github.ref_name }}
30-
release-as: ${{ steps.extract-version.outputs.version }}
41+
target-branch: ${{ steps.version.outputs.branch }}
42+
release-as: ${{ steps.version.outputs.version }}

0 commit comments

Comments
 (0)