From 25c81834b0585bb0fa07470d9860f71d7c1524fc Mon Sep 17 00:00:00 2001 From: Ty Hopp Date: Sat, 21 Sep 2024 19:33:31 +0800 Subject: [PATCH] chore: generate changelog for release --- .github/workflows/cd.yml | 19 ++++++++++++++----- changelog.sh | 8 ++++++++ 2 files changed, 22 insertions(+), 5 deletions(-) create mode 100755 changelog.sh diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index 8048ff3..fb66ebe 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -17,6 +17,8 @@ jobs: steps: - name: checkout-code uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: set-up-go uses: actions/setup-go@v5 @@ -24,11 +26,18 @@ jobs: - name: build run: make + - name: generate-changelog + id: changelog + run: | + changelog=$(./changelog.sh) + echo "::set-output name=changelog::$changelog" + - name: release uses: softprops/action-gh-release@v2 with: - files: | - lenv-linux-amd64 - lenv-linux-arm64 - lenv-windows-amd64.exe - LICENSE + files: | + lenv-linux-amd64 + lenv-linux-arm64 + lenv-windows-amd64.exe + LICENSE + body: ${{ steps.changelog.outputs.changelog }} diff --git a/changelog.sh b/changelog.sh new file mode 100755 index 0000000..03b71fa --- /dev/null +++ b/changelog.sh @@ -0,0 +1,8 @@ +LATEST_TAG=$(git describe --tags --abbrev=0 HEAD^) +REPO_URL=$(git config --get remote.origin.url) +REPO_URL=${REPO_URL%.git} +REPO_URL=${REPO_URL#git@} +REPO_URL=${REPO_URL#https://} +REPO_URL=${REPO_URL/:/\/} +REPO_URL="https://${REPO_URL}" +git log --pretty=format:"- [%h](${REPO_URL}/commit/%H) %s" ${LATEST_TAG}..HEAD \ No newline at end of file