Skip to content

Commit 5be3035

Browse files
committed
feat(release): added support for remote shared config to be used to configure git-cliff
This change affects the release.yml workflow by bringing in new options. Existing behavior is not modified, thanks to default input values (.cliff.toml). New feature: If no local .cliff.toml config is found (or any specific local config file provided as input), a remote config is used. The default is to use as a shared config the .cliff.toml of this repo on master. * fixes #36 Signed-off-by: Frederic BIDON <[email protected]>
1 parent 6afeb7f commit 5be3035

File tree

3 files changed

+65
-4
lines changed

3 files changed

+65
-4
lines changed

.github/workflows/bump-release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ on:
4242
(use "|" to replace end of line).
4343
required: false
4444
type: string
45+
cliff-config:
46+
type: string
47+
required: false
48+
default: '.cliff.toml'
49+
description: 'Path to the git-cliff config file in the caller repository'
50+
cliff-config-url:
51+
type: string
52+
required: false
53+
default: 'https://raw.githubusercontent.com/go-openapi/ci-workflows/refs/heads/master/.cliff.toml'
54+
description: 'URL to the remote git-cliff config file (used if local config does not exist)'
4555

4656
jobs:
4757
tag-release:
@@ -130,4 +140,6 @@ jobs:
130140
uses: ./.github/workflows/release.yml
131141
with:
132142
tag: ${{ needs.tag-release.outputs.next-tag}}
143+
cliff-config: ${{ inputs.cliff-config }}
144+
cliff-config-url: ${{ inputs.cliff-config-url }}
133145
secrets: inherit

.github/workflows/release.yml

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ on:
1414
tag:
1515
type: string
1616
required: true
17+
cliff-config:
18+
type: string
19+
required: false
20+
default: '.cliff.toml'
21+
description: 'Path to the git-cliff config file in the caller repository'
22+
cliff-config-url:
23+
type: string
24+
required: false
25+
default: 'https://raw.githubusercontent.com/go-openapi/ci-workflows/refs/heads/master/.cliff.toml'
26+
description: 'URL to the remote git-cliff config file (used if local config does not exist)'
1727

1828
jobs:
1929
gh-release:
@@ -49,22 +59,49 @@ jobs:
4959
echo "Message in git tag ${{ inputs.tag }}"
5060
echo "$MESSAGE"
5161
-
52-
name: Generate release notes
62+
name: Check for local cliff config
63+
id: check-config
64+
run: |
65+
if [ -f "${{ inputs.cliff-config }}" ]; then
66+
echo "exists=true" >> "${GITHUB_OUTPUT}"
67+
echo "::notice title=release::Local config file '${{ inputs.cliff-config }}' found"
68+
else
69+
echo "exists=false" >> "${GITHUB_OUTPUT}"
70+
echo "::notice title=release::Local config file '${{ inputs.cliff-config }}' not found, will use remote config"
71+
fi
72+
-
73+
name: Generate release notes (local config)
5374
# this uses git-cliff to generate a release note from the commit history
54-
id: notes
75+
if: ${{ steps.check-config.outputs.exists == 'true' }}
76+
id: notes-local
77+
env:
78+
GITHUB_TOKEN: ${{ github.token }}
79+
GITHUB_REPO: ${{ github.repository }}
80+
uses: orhun/git-cliff-action@d77b37db2e3f7398432d34b72a12aa3e2ba87e51 # v4.6.0
81+
with:
82+
config: ${{ inputs.cliff-config }}
83+
args: >-
84+
--current
85+
--with-tag-message '${{ steps.get-message.outputs.message }}'
86+
-
87+
name: Generate release notes (remote config)
88+
# this uses git-cliff action with remote config URL
89+
if: ${{ steps.check-config.outputs.exists == 'false' }}
90+
id: notes-remote
5591
env:
5692
GITHUB_TOKEN: ${{ github.token }}
5793
GITHUB_REPO: ${{ github.repository }}
5894
uses: orhun/git-cliff-action@d77b37db2e3f7398432d34b72a12aa3e2ba87e51 # v4.6.0
5995
with:
60-
config: '.cliff.toml'
96+
config: ''
6197
args: >-
98+
--config-url '${{ inputs.cliff-config-url }}'
6299
--current
63100
--with-tag-message '${{ steps.get-message.outputs.message }}'
64101
-
65102
name: Create github release
66103
uses: softprops/action-gh-release@a06a81a03ee405af7f2048a818ed3f03bbf83c7b # v2.5.0
67104
with:
68-
body: ${{ steps.notes.outputs.content }}
105+
body: ${{ steps.check-config.outputs.exists == 'true' && steps.notes-local.outputs.content || steps.notes-remote.outputs.content }}
69106
tag_name: ${{ inputs.tag }}
70107
generate_release_notes: false # skip auto-generated release notes from github API

.github/workflows/tag-release.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,16 @@ on:
1414
tag:
1515
type: string
1616
required: true
17+
cliff-config:
18+
type: string
19+
required: false
20+
default: '.cliff.toml'
21+
description: 'Path to the git-cliff config file in the caller repository'
22+
cliff-config-url:
23+
type: string
24+
required: false
25+
default: 'https://raw.githubusercontent.com/go-openapi/ci-workflows/refs/heads/master/.cliff.toml'
26+
description: 'URL to the remote git-cliff config file (used if local config does not exist)'
1727

1828
jobs:
1929
gh-release:
@@ -26,4 +36,6 @@ jobs:
2636
uses: ./.github/workflows/release.yml
2737
with:
2838
tag: ${{ github.ref_name }}
39+
cliff-config: ${{ inputs.cliff-config }}
40+
cliff-config-url: ${{ inputs.cliff-config-url }}
2941
secrets: inherit

0 commit comments

Comments
 (0)