Skip to content

Commit b6caa9f

Browse files
scott45github-actions
andauthored
ci: sync workflows from central-workflows Signed-off-by: Scott <[email protected]> (#262)
Co-authored-by: github-actions <[email protected]>
1 parent a24379b commit b6caa9f

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

.github/workflows/dockerhub-image-build.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ name: Publish Docker image
1616
on:
1717
push:
1818
branches: [ "main" ]
19-
release:
20-
types: [published]
2119

2220
jobs:
2321
push_to_registry:

.github/workflows/release.yml

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010
properties:
1111
milestone_number:
1212
type: string
13+
workflow_dispatch:
1314

1415
jobs:
1516
release:
@@ -41,33 +42,32 @@ jobs:
4142
if: ${{ steps.release-label.outputs.level != null }}
4243
with:
4344
semver_only: true
45+
46+
- name: Get Last Merged PR
47+
id: get_merged_pr
48+
uses: actions-ecosystem/action-get-merged-pull-request@v1
49+
with:
50+
github_token: ${{ secrets.GITHUB_TOKEN }}
4451

45-
# Determine the release type (major, minor, patch) based on commit messages
46-
- name: Determine Release Type
52+
# Determine the release type (major, minor, patch) based on Last Merged PR Title
53+
- name: Determine Release Type from PR Title
4754
id: determine_release
4855
run: |
49-
PREV_VERSION=$(git describe --abbrev=0 --tags)
50-
echo "Previous Version: $PREV_VERSION"
51-
52-
COMMIT_MESSAGES=$(git log $PREV_VERSION^..HEAD --format=%B)
53-
echo "Commit Messages: $COMMIT_MESSAGES"
54-
55-
# Determine release type based on commit messages and labels
56-
RELEASE_TYPE="patch" # Default to patch
57-
58-
if echo "$COMMIT_MESSAGES" | grep -q -e "BREAKING CHANGE:"; then
56+
PR_TITLE="${{ steps.get_merged_pr.outputs.title }}"
57+
echo "PR Title: $PR_TITLE"
58+
59+
RELEASE_TYPE="patch" # Default release type
60+
if echo "$PR_TITLE" | grep -q "^BREAKING CHANGE:"; then
5961
RELEASE_TYPE="major"
60-
elif echo "$COMMIT_MESSAGES" | grep -q -e "feat!:"; then
62+
elif echo "$PR_TITLE" | grep -q "^feat!:"; then
6163
RELEASE_TYPE="major"
62-
elif echo "$COMMIT_MESSAGES" | grep -q -e "feat:"; then
64+
elif echo "$PR_TITLE" | grep -q "^feat:"; then
6365
RELEASE_TYPE="minor"
64-
elif echo "$COMMIT_MESSAGES" | grep -q -e "feat:" && (echo "$COMMIT_MESSAGES" | grep -q -e "fix:" || echo "$COMMIT_MESSAGES" | grep -q -e "enhancement:" || echo "$COMMIT_MESSAGES" | grep -q -e "docs:" || echo "$COMMIT_MESSAGES" | grep -q -e "refactor:" || echo "$COMMIT_MESSAGES" | grep -q -e "chore:"); then
65-
RELEASE_TYPE="minor"
66-
elif echo "$COMMIT_MESSAGES" | grep -q -e "fix:" -e "enhancement:" -e "docs:" -e "refactor:" -e "chore:" -e "build:" -e "ci:" -e "perf:" -e "style:" -e "test:" -e "chore(deps):" -e "chore(deps-dev):"; then
66+
else
6767
RELEASE_TYPE="patch"
6868
fi
69-
70-
echo "Release Type: $RELEASE_TYPE"
69+
70+
echo "Determined Release Type: $RELEASE_TYPE"
7171
echo "::set-output name=release_type::$RELEASE_TYPE"
7272

7373
# Bump the version based on the determined release type

0 commit comments

Comments
 (0)