Skip to content

Commit 90f6a97

Browse files
committed
ci: fixed release can be called by other workflow
Signed-off-by: Frédéric BIDON <fredbi@yahoo.com>
1 parent 7f9174a commit 90f6a97

2 files changed

Lines changed: 19 additions & 3 deletions

File tree

.github/workflows/bump-release.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ jobs:
4848
runs-on: ubuntu-latest
4949
permissions:
5050
contents: write
51+
outputs:
52+
next-tag: ${{ steps.bump-release.outputs.next-tag }}
5153
steps:
5254
-
5355
name: Checkout code
@@ -126,6 +128,7 @@ jobs:
126128
contents: write
127129
steps:
128130
-
129-
uses: ./release.yml@master
131+
uses: ./.github/workflows/release.yml
130132
with:
133+
tag: ${{ needs.tag-release.outputs.next-tag}}
131134
secrets: inherit

.github/workflows/release.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ on:
1212
push:
1313
tags:
1414
- v[0-9]+*
15+
workflow_call:
16+
inputs:
17+
tag:
18+
type: string
19+
required: true
1520

1621
jobs:
1722
gh-release:
@@ -30,8 +35,16 @@ jobs:
3035
id: get-message
3136
# tag message is not retrieved unless with fetch the ref explictly
3237
run: |
38+
set -x
39+
REF='${{ github_ref_name }}'
40+
INPUT_TAG='${{ inputs.tag }}'
41+
if [[ -n "${INPUT_TAG}" ]] ; then
42+
# release workflow triggered from another workflow, not a push event
43+
REF="${INPUT_TAG}"
44+
fi
45+
3346
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
34-
MESSAGE=$(git tag -l '${{ github.ref_name }}' --format='%(contents:subject)
47+
MESSAGE=$(git tag -l "${REF}" --format='%(contents:subject)
3548
3649
%(contents:body)
3750
')
@@ -42,7 +55,7 @@ jobs:
4255
echo 'EOF'
4356
} >> "${GITHUB_OUTPUT}"
4457
45-
echo "Message in git tag ${{ github.ref_name }}"
58+
echo "Message in git tag ${REF}"
4659
echo "$MESSAGE"
4760
-
4861
name: Generate release notes

0 commit comments

Comments
 (0)