From 1fa6c0036a043b47dd0588595299601698256181 Mon Sep 17 00:00:00 2001 From: Bengt Wegner Date: Thu, 19 Sep 2024 10:12:48 +0200 Subject: [PATCH 1/4] chore: add binaries to releases Signed-off-by: Bengt Wegner --- .github/workflows/release_binaries.yml | 60 ++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/release_binaries.yml diff --git a/.github/workflows/release_binaries.yml b/.github/workflows/release_binaries.yml new file mode 100644 index 0000000..6cf511b --- /dev/null +++ b/.github/workflows/release_binaries.yml @@ -0,0 +1,60 @@ +name: Build Release Binaries + +on: + release: + types: + - created + +jobs: + build: + name: Build Release Assets + runs-on: ubuntu-latest + + strategy: + matrix: + # Add more platforms as needed + goos: [linux, darwin, windows] + goarch: [amd64, arm64] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.23' + + - name: Install dependencies + run: go get . + + - name: Display the release tag + run: echo ${{ github.event.release.tag_name }} + + - name: Cache Go modules + uses: actions/cache@v3 + with: + path: | + ~/go/pkg/mod + ~/go/bin + key: ${{ runner.os }}-go-${{ matrix.goos }}-${{ matrix.goarch }}-${{ hashFiles('**/go.sum') }} + restore-keys: | + ${{ runner.os }}-go-${{ matrix.goos }}-${{ matrix.goarch }} + + - name: Build binary + run: | + mkdir -p dist + GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/app-${{ matrix.goos }}-${{ matrix.goarch }} . + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: binaries + path: dist/ + + - name: Upload the binaries + uses: svenstaro/upload-release-action@2.9.0 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ github.ref }} + file: dist/* + file_glob: true \ No newline at end of file From 6e60033329239d308e61a4a0d7f29e701eedbc02 Mon Sep 17 00:00:00 2001 From: Bengt Wegner Date: Thu, 19 Sep 2024 10:13:29 +0200 Subject: [PATCH 2/4] test --- .github/workflows/release_binaries.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release_binaries.yml b/.github/workflows/release_binaries.yml index 6cf511b..6df8098 100644 --- a/.github/workflows/release_binaries.yml +++ b/.github/workflows/release_binaries.yml @@ -1,6 +1,8 @@ name: Build Release Binaries on: + push: + branches: [ "chore/release_binaries" ] release: types: - created From 67b78f7e72fedd7b1d31d0aab9de45c20d6c0626 Mon Sep 17 00:00:00 2001 From: Bengt Wegner Date: Thu, 19 Sep 2024 10:15:36 +0200 Subject: [PATCH 3/4] Chore: Remove unverified gh action Signed-off-by: Bengt Wegner --- .github/workflows/release_binaries.yml | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release_binaries.yml b/.github/workflows/release_binaries.yml index 6df8098..7f4cfcb 100644 --- a/.github/workflows/release_binaries.yml +++ b/.github/workflows/release_binaries.yml @@ -3,9 +3,6 @@ name: Build Release Binaries on: push: branches: [ "chore/release_binaries" ] - release: - types: - - created jobs: build: @@ -25,13 +22,7 @@ jobs: uses: actions/setup-go@v5 with: go-version: '1.23' - - - name: Install dependencies - run: go get . - - - name: Display the release tag - run: echo ${{ github.event.release.tag_name }} - + - name: Cache Go modules uses: actions/cache@v3 with: @@ -51,12 +42,4 @@ jobs: uses: actions/upload-artifact@v3 with: name: binaries - path: dist/ - - - name: Upload the binaries - uses: svenstaro/upload-release-action@2.9.0 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - tag: ${{ github.ref }} - file: dist/* - file_glob: true \ No newline at end of file + path: dist/ \ No newline at end of file From 5f20d36632e5f085a3233a9cf01496ccbd73b4ea Mon Sep 17 00:00:00 2001 From: Bengt Wegner Date: Thu, 19 Sep 2024 10:27:51 +0200 Subject: [PATCH 4/4] chore: renamed resulting artifacts and action Signed-off-by: Bengt Wegner --- .github/workflows/release_binaries.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release_binaries.yml b/.github/workflows/release_binaries.yml index 7f4cfcb..494e87b 100644 --- a/.github/workflows/release_binaries.yml +++ b/.github/workflows/release_binaries.yml @@ -1,8 +1,8 @@ -name: Build Release Binaries +name: Build Binaries on: push: - branches: [ "chore/release_binaries" ] + branches: [ "main" ] jobs: build: @@ -36,7 +36,7 @@ jobs: - name: Build binary run: | mkdir -p dist - GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/app-${{ matrix.goos }}-${{ matrix.goarch }} . + GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/${{ github.event.repository.name }}_${{ matrix.goos }}_${{ matrix.goarch }} . - name: Upload build artifacts uses: actions/upload-artifact@v3