Skip to content

Commit

Permalink
hotfix(release): corrected release variables to have more readability
Browse files Browse the repository at this point in the history
Signed-off-by: Felipe Rios <[email protected]>
  • Loading branch information
rios0rios0 committed Dec 4, 2023
1 parent bfe7833 commit 11e9483
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 5 additions & 3 deletions azure-devops/global/stages/40-delivery/release.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
jobs:
- job: 'release'
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), contains(variables['Build.SourceVersionMessage'], 'origin/chore/bump-'))
condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/main'), or(contains(variables['Build.SourceVersionMessage'], 'origin/chore/bump-'), contains(variables['Build.SourceVersionMessage'], 'chore(bump)')))
steps:
- script: |
set -eux
COMMIT_MESSAGE="$(git log -1 --pretty=%B)"
if echo -n "$COMMIT_MESSAGE" | grep -Eq "^Merge (remote-tracking|remote|tracking)? ?branch '(origin\/)?chore\/bump-([0-9]+\.[0-9]+\.[0-9]+)'.*$"; then
VERSION=$(echo "$COMMIT_MESSAGE" | sed -En "s/^Merge.*branch '(origin\/)?chore\/bump-([^']+)'.*$/\2/p")
REGEX="^Merge (remote-tracking|remote|tracking)? ?branch '(origin\/)?chore\/bump-([0-9]+\.[0-9]+\.[0-9]+)'.*|.*chore\(bump\) *.* to ([0-9]+\.[0-9]+\.[0-9]+)$"
if echo -n "$COMMIT_MESSAGE" | grep -Eq "$REGEX"; then
VERSION=$(echo "$COMMIT_MESSAGE" | sed -En "s/$REGEX/\3\4/p")
RELEASE_NOTES=""
if [ -f CHANGELOG.md ]; then
Expand Down
6 changes: 4 additions & 2 deletions gitlab/global/stages/40-delivery/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ release:
script:
- |
set -eux
if echo "$CI_COMMIT_MESSAGE" | grep -Eq "^Merge (remote-tracking|remote|tracking)? ?branch '(origin\/)?chore\/bump-([0-9]+\.[0-9]+\.[0-9]+)'.*$"; then
VERSION=$(echo "$CI_COMMIT_MESSAGE" | sed -En "s/^Merge.*branch '(origin\/)?chore\/bump-([^']+)'.*$/\2/p")
REGEX="^Merge (remote-tracking|remote|tracking)? ?branch '(origin\/)?chore\/bump-([0-9]+\.[0-9]+\.[0-9]+)'.*$"
if echo "$CI_COMMIT_MESSAGE" | grep -Eq "$REGEX"; then
VERSION=$(echo "$CI_COMMIT_MESSAGE" | sed -En "s/$REGEX/\3/p")
RELEASE_NOTES=""
if [ -f CHANGELOG.md ]; then
Expand Down

0 comments on commit 11e9483

Please sign in to comment.