2929 - name : Set up Go
3030 uses : actions/setup-go@v4
3131 with :
32- go-version : ' 1.24 '
32+ go-version : ' 1.25 '
3333 cache : false
3434
3535 - name : Run tests
3939 name : Build and Publish
4040 needs : test
4141 runs-on : ubuntu-latest
42+ outputs :
43+ version : ${{ steps.get_version.outputs.version }}
44+ changelog : ${{ steps.changelog.outputs.changelog }}
4245 steps :
4346 - name : Checkout code
4447 uses : actions/checkout@v4
5154 # If triggered by a tag push, use the tag name.
5255 # If triggered manually, use the input version.
5356 if [[ "${{ github.event_name }}" == "push" ]]; then
54- echo " VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
57+ VERSION=" ${{ github.ref_name }}"
5558 elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
56- echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
59+ VERSION="${{ inputs.version }}"
60+ fi
61+ echo "VERSION=$VERSION" >> $GITHUB_ENV
62+ echo "version=$VERSION" >> $GITHUB_OUTPUT
63+
64+ - name : Get Previous Tag
65+ id : get_previous_tag
66+ run : |
67+ PREVIOUS_TAG=$(git tag --sort=-version:refname | grep -v "^${{ env.VERSION }}$" | head -n 1)
68+ if [[ -z "$PREVIOUS_TAG" ]]; then
69+ echo "PREVIOUS_TAG=" >> $GITHUB_OUTPUT
70+ echo "No previous tag found"
71+ else
72+ echo "PREVIOUS_TAG=$PREVIOUS_TAG" >> $GITHUB_OUTPUT
73+ echo "Previous tag: $PREVIOUS_TAG"
5774 fi
5875
5976 - name : Generate Changelog
6279 with :
6380 mode : " HYBRID"
6481 configuration : " .github/changelog-config.json"
65- fromTag : ${{ env .PREVIOUS_TAG }}
82+ fromTag : ${{ steps.get_previous_tag.outputs .PREVIOUS_TAG }}
6683 toTag : ${{ env.VERSION }}
84+ failOnError : false
6785 env :
6886 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6987
@@ -125,7 +143,7 @@ jobs:
125143 GOOS=$GOOS GOARCH=$GOARCH go build -ldflags="-s -w -X 'github.com/haloydev/haloy/internal/constants.Version=${{ env.VERSION }}'" -o "dist/$OUTPUT_NAME" ./cmd/haloy
126144 done
127145
128- # haloyadm - Linux only ( server administration tool)
146+ # haloyadm CLI - server administration tool (typically used on Linux servers )
129147 HALOYADM_PLATFORMS=("linux/amd64" "linux/arm64")
130148
131149 for platform in "${HALOYADM_PLATFORMS[@]}"; do
@@ -155,13 +173,6 @@ jobs:
155173 needs : build-and-publish
156174 runs-on : ubuntu-latest
157175 steps :
158- - name : Determine Version
159- run : |
160- if [[ "${{ github.event_name }}" == "push" ]]; then
161- echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
162- elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
163- echo "VERSION=${{ inputs.version }}" >> $GITHUB_ENV
164- fi
165176 - name : Download artifacts
166177 uses : actions/download-artifact@v4
167178 with :
@@ -171,7 +182,8 @@ jobs:
171182 - name : Create or Update Release
172183 uses : softprops/action-gh-release@v1
173184 with :
174- tag_name : ${{ env.VERSION }}
185+ tag_name : ${{ needs.build-and-publish.outputs.version }}
186+ body : ${{ needs.build-and-publish.outputs.changelog }}
175187 files : |
176188 dist/haloy-linux-amd64
177189 dist/haloy-linux-arm64
@@ -183,6 +195,6 @@ jobs:
183195 dist/haloyadm-linux-arm64
184196 dist/checksums.txt
185197 draft : false
186- prerelease : ${{ contains(env.VERSION , 'alpha') || contains(env.VERSION , 'beta') || contains(env.VERSION , 'rc') }}
198+ prerelease : ${{ contains(needs.build-and-publish.outputs.version , 'alpha') || contains(needs.build-and-publish.outputs.version , 'beta') || contains(needs.build-and-publish.outputs.version , 'rc') }}
187199 env :
188200 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments