Skip to content

Commit

Permalink
use gorelease instead of a local tool
Browse files Browse the repository at this point in the history
  • Loading branch information
skudasov committed Sep 11, 2024
1 parent 1822be8 commit d1a9699
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions .github/workflows/release-go-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,35 +37,33 @@ jobs:
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Show Package Name and Version
run: |
echo "Package Name: ${{ env.PACKAGE_NAME }}"
echo "Version: ${{ env.VERSION }}"
- name: Find Last Tag for Package and Generate Release Notes
id: generate_release_notes
run: |

Check failure on line 42 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L42

shellcheck reported issue in this script: SC2046:warning:7:70: Quote this to prevent word splitting [shellcheck]
Raw output
.github/workflows/release-go-module.yml:42:9: shellcheck reported issue in this script: SC2046:warning:7:70: Quote this to prevent word splitting [shellcheck]

Check failure on line 42 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L42

shellcheck reported issue in this script: SC2129:style:26:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck]
Raw output
.github/workflows/release-go-module.yml:42:9: shellcheck reported issue in this script: SC2129:style:26:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck]

Check failure on line 42 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L42

shellcheck reported issue in this script: SC2086:info:26:30: Double quote to prevent globbing and word splitting [shellcheck]
Raw output
.github/workflows/release-go-module.yml:42:9: shellcheck reported issue in this script: SC2086:info:26:30: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 42 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L42

shellcheck reported issue in this script: SC2086:info:27:20: Double quote to prevent globbing and word splitting [shellcheck]
Raw output
.github/workflows/release-go-module.yml:42:9: shellcheck reported issue in this script: SC2086:info:27:20: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 42 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L42

shellcheck reported issue in this script: SC2086:info:28:15: Double quote to prevent globbing and word splitting [shellcheck]
Raw output
.github/workflows/release-go-module.yml:42:9: shellcheck reported issue in this script: SC2086:info:28:15: Double quote to prevent globbing and word splitting [shellcheck]
# Extract the package name and version from the tag
TAG_REF="${GITHUB_REF#refs/tags/}"
PACKAGE_NAME=$(echo "$TAG_REF" | cut -d'/' -f1)
VERSION=$(echo "$TAG_REF" | cut -d'/' -f2)
# Find the latest tag for the same package that is not the current tag
LAST_TAG=$(git describe --abbrev=0 --match "$PACKAGE_NAME/v*" --tags $(git rev-list --tags --skip=1 --max-count=1))
# If no previous tag is found, use the initial commit as the reference
if [ -z "$LAST_TAG" ]; then
LAST_TAG=$(git rev-list --max-parents=0 HEAD)
fi
echo "Last tag found: $LAST_TAG"
# Extract the version part of the last tag
LAST_TAG_VERSION=$(echo "$LAST_TAG" | cut -d'/' -f2)
echo "Last tag version: $LAST_TAG_VERSION"
# Get the commits between the last tag and the current tag
COMMITS=$(git log "$LAST_TAG..$PACKAGE_NAME/$VERSION" --pretty=format:"- %s (%h)")
# Output the release notes
echo "Release notes:"
echo "$COMMITS"
# Safely set the release notes as an environment variable using heredoc and EOF
echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
echo "$COMMITS" >> $GITHUB_ENV
Expand All @@ -82,8 +80,7 @@ jobs:
id: check_breaking_changes
run: |

Check failure on line 81 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L81

shellcheck reported issue in this script: SC2086:info:2:36: Double quote to prevent globbing and word splitting [shellcheck]
Raw output
.github/workflows/release-go-module.yml:81:9: shellcheck reported issue in this script: SC2086:info:2:36: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 81 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L81

shellcheck reported issue in this script: SC2086:info:2:63: Double quote to prevent globbing and word splitting [shellcheck]
Raw output
.github/workflows/release-go-module.yml:81:9: shellcheck reported issue in this script: SC2086:info:2:63: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 81 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L81

shellcheck reported issue in this script: SC2129:style:5:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck]
Raw output
.github/workflows/release-go-module.yml:81:9: shellcheck reported issue in this script: SC2129:style:5:1: Consider using { cmd1; cmd2; } >> file instead of individual redirects [shellcheck]

Check failure on line 81 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L81

shellcheck reported issue in this script: SC2086:info:5:33: Double quote to prevent globbing and word splitting [shellcheck]
Raw output
.github/workflows/release-go-module.yml:81:9: shellcheck reported issue in this script: SC2086:info:5:33: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 81 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L81

shellcheck reported issue in this script: SC2086:info:6:29: Double quote to prevent globbing and word splitting [shellcheck]
Raw output
.github/workflows/release-go-module.yml:81:9: shellcheck reported issue in this script: SC2086:info:6:29: Double quote to prevent globbing and word splitting [shellcheck]

Check failure on line 81 in .github/workflows/release-go-module.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] .github/workflows/release-go-module.yml#L81

shellcheck reported issue in this script: SC2086:info:7:15: Double quote to prevent globbing and word splitting [shellcheck]
Raw output
.github/workflows/release-go-module.yml:81:9: shellcheck reported issue in this script: SC2086:info:7:15: Double quote to prevent globbing and word splitting [shellcheck]
set +e # Disable exit on error to capture output even if the command fails
# sed is used to remove ascii color codes
BREAKING_CHANGES=$(go run cmd/main.go -path $GITHUB_WORKSPACE/${{ env.PACKAGE_NAME }} 2>&1 | sed -r "s/\x1B\[[0-9;]*[mK]//g")
BREAKING_CHANGES=$(gorelease -base $LAST_TAG_VERSION -version $VERSION 2>&1 | sed -r "s/\x1B\[[0-9;]*[mK]//g")
echo "Breaking changes: ${BREAKING_CHANGES}"
set -e # Re-enable exit on error for the subsequent steps
echo "BREAKING_CHANGES<<EOF" >> $GITHUB_ENV
Expand Down

0 comments on commit d1a9699

Please sign in to comment.