From 04aa04a8fa2a961cf1cbfcd12a65f0416d1ea331 Mon Sep 17 00:00:00 2001 From: "Adam C. Migus" Date: Thu, 12 Sep 2024 16:56:17 -0400 Subject: [PATCH] Build fixes. - Set the version via the environment - Update upload and download-artifacts to v4 --- .github/workflows/release.yml | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc5837e..ce95ad1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -29,20 +29,24 @@ jobs: - name: Setup Go uses: actions/setup-go@v5 - - name: Build go program + - name: Declare version + run: | + echo BUILD_VERSION="$(git describe --tags --always)" >> $GITHUB_ENV + + - name: BUILD_VERSION go program id: cgo-action uses: go-cross/cgo-actions@v1 + env: + BUILD_VERSION: ${{ env.BUILD_VERSION }} with: - flags: -ldflags=-w -s -X 'github.com/Keeper-Security/linux-keyring-utility/cmd.Version=$(git describe --tags --always)' + flags: -ldflags=-X 'github.com/Keeper-Security/linux-keyring-utility/cmd.Version=${{ env.BUILD_VERSION }}' targets: ${{ matrix.targets }} output: lkru-${{ github.ref_name }}_$target$ext - - run: echo "${{ steps.cgo-action.outputs.files }}" - - name: Upload Release Artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: binaries + name: binaries-${{ matrix.targets }} path: | bin/*-${{ github.ref_name }}_* @@ -58,15 +62,20 @@ jobs: passphrase: ${{ secrets.GPG_PASSPHRASE }} - name: Download artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: binaries - - - name: Create checksums + path: bin + pattern: binaries-* + merge-multiple: true + + - name: Strip binaries with symbols run: | - shasum -a 256 *-${{ github.ref_name }}_* >| checksums.txt - file *-${{ github.ref_name }}_* checksums.txt + strip -s bin/*_linux-amd64 + - name: Create checksums + run: | + cd bin; shasum -a 256 *-${{ github.ref_name }}_* >| ../checksums.txt + - name: Sign checksums run: | GPG_TTY=$(tty) gpg -vvv --batch --yes --detach-sign --armor \ @@ -89,7 +98,7 @@ jobs: run: | gh release upload "${{ github.ref_name }}" \ --repo "${{ github.repository }}" \ - *-${{ github.ref_name }}_* \ + bin/*-${{ github.ref_name }}_* \ checksums.txt checksums.txt.sig