From d3a290b9f9eccce5ebd0b88597f2ef00ddf5c32c Mon Sep 17 00:00:00 2001 From: fkwp Date: Fri, 15 Dec 2023 16:57:50 +0100 Subject: [PATCH 1/2] add gh action to create release artifacts --- .github/workflows/release.yaml | 41 ++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..b97fa1e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,41 @@ +name: "Create draft release with binaries after tag" +on: + push: + tags: ["v*"] +permissions: + contents: write # to upload the binaries to the release +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + os: ["linux"] + arch: ["amd64", "arm64"] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-go@v4 + with: + go-version: "1.20" + - run: mkdir build + - run: go build -trimpath -o build/lk-jwt-service_${{ matrix.os }}_${{ matrix.arch }} ./main.go + env: + GOOS: ${{ matrix.os }} + GOARCH: ${{ matrix.arch }} + - name: "Upload binary as artifact" + uses: actions/upload-artifact@v3 + with: + name: build + path: build/lk-jwt-service_${{ matrix.os }}_${{ matrix.arch }} + + create-release: + needs: ["build"] + runs-on: ubuntu-latest + steps: + - name: "Fetch all binaries" + uses: actions/download-artifact@v3 + - name: "Create release" + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1 + with: + files: build/* + draft: True + fail_on_unmatched_files: true From 4db758645b087f489134f238a3f106a98e4a3d10 Mon Sep 17 00:00:00 2001 From: fkwp Date: Tue, 19 Mar 2024 20:35:23 +0000 Subject: [PATCH 2/2] make upload name os and arch dependent --- .github/workflows/release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b97fa1e..8aeaba4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -24,7 +24,7 @@ jobs: - name: "Upload binary as artifact" uses: actions/upload-artifact@v3 with: - name: build + name: binary_${{ matrix.os }}_${{ matrix.arch }} path: build/lk-jwt-service_${{ matrix.os }}_${{ matrix.arch }} create-release: