Skip to content

Commit cc63026

Browse files
authored
fix: Add "git-note" for "Semantic Release" (#12)
* fix: Remove "branches" from "prepare release" By default the [default](https://semantic-release.gitbook.io/semantic-release/usage/configuration#branches) config is used, which can be overridden on repo basis. * fix: Add missing "git-notes" * fix: Conditional git-notes * chore: Example update
1 parent c939634 commit cc63026

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

actions/prepare-release/.releaserc.yaml.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,8 @@ plugins:
33
- preset: conventionalcommits
44
- - "@semantic-release/release-notes-generator"
55
- preset: conventionalcommits
6+
# For pre-release branches
7+
branches:
8+
- main
9+
- name: (alpha|beta|rc)
10+
prerelease: true

actions/prepare-release/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ It is expected this action to be used with other actions to perform tag and rele
2727
id: prepare_release
2828
uses: elastiflow/gha-reusable/actions/prepare-release@v0
2929
with:
30-
branch: "${{ github.ref_name }}"
30+
add_git_notes: true
3131
changelog_update: true
3232
bump_version_yaml: true
3333
bump_version_yaml_path: galaxy.yml

actions/prepare-release/action.yml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
name: 'Prepare release'
22
description: 'Update manifests, changelog before the release'
33
inputs:
4-
branch:
5-
required: true
6-
description: "Release branch"
74
commit_back:
85
default: "false"
96
description: "Commit and push version updates"
7+
add_git_notes:
8+
default: "false"
9+
description: "Add and push \"semantic-release\" git notes to determine release channel. Should be `true` if release is going to be done"
1010
changelog_update:
1111
default: "false"
1212
description: "Update changelog"
@@ -72,10 +72,6 @@ runs:
7272
ci: false
7373
dry_run: true
7474
unset_gha_env: true
75-
branches: |
76-
[
77-
'${{ inputs.branch }}'
78-
]
7975
extra_plugins: |
8076
conventional-changelog-conventionalcommits
8177
- name: Bump version in YAML
@@ -108,3 +104,12 @@ runs:
108104
with:
109105
commit_message: |
110106
doc: Update version/changelog
107+
# Git notes are needed for "semantic-release" to properly detect release channel
108+
- name: Add git notes
109+
if: ${{ fromJson(steps.semantic_release.outputs.new_release_published) && fromJson(inputs.add_git_notes)}}
110+
shell: bash
111+
run: |
112+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
113+
git config --global user.name "github-actions[bot]"
114+
git notes --ref semantic-release add -f -m '{"channels":["${{ steps.semantic_release.outputs.new_release_channel }}"]}'
115+
git push origin refs/notes/semantic-release

0 commit comments

Comments
 (0)