ea913c97e38d7f1d9295977994f0d4cdb5d8bab6

Author
td-jizdebski <jakub.izdebski@jrdltd.co.uk>
Committer
GitHub <noreply@github.com>
Date

Message

Fix releseses and add upx for linux (#11)

* relese upx

* change action

* fix release

Diff

 1diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
 2index 490c1d0153bac4dfdbf6a3ef894d3377f66d6e59..ded93a536354d53833a353061d40a243a9e70629 100644
 3--- a/.github/workflows/release.yml
 4+++ b/.github/workflows/release.yml
 5@@ -29,9 +29,43 @@ jobs:
 6         GOOS: ${{ matrix.goos }}
 7         GOARCH: ${{ matrix.goarch }}
 8       run: |
 9-        go build -o logfmt-${{ matrix.goos }}-${{ matrix.goarch }}-${{ github.ref_name }}
10+        go build -ldflags="-s -w" -o logfmt-${{ matrix.goos }}-${{ matrix.goarch }}-${{ github.ref_name }}
11+      
12+    - name: Compress with UPX (Linux only)
13+      if: matrix.goos == 'linux'
14+      uses: crazy-max/ghaction-upx@v3
15+      with:
16+        files: |
17+          ./logfmt-${{ matrix.goos }}-${{ matrix.goarch }}-${{ github.ref_name }}
18+        args: --best --lzma
19+
20+    - name: Upload Build Artifact
21+      uses: actions/upload-artifact@v4
22+      with:
23+        name: logfmt-${{ matrix.goos }}-${{ matrix.goarch }} # Unique name for each artifact
24+        path: ./logfmt-${{ matrix.goos }}-${{ matrix.goarch }}-${{ github.ref_name }} # Path to the built executable
25+        retention-days: 1
26+
27+  create_release:
28+    runs-on: ubuntu-latest
29+    needs: build_release
30+    permissions:
31+      contents: write
32+
33+    steps:
34+    - name: Checkout code
35+      uses: actions/checkout@v4
36+
37+    - name: Download all build artifacts
38+      uses: actions/download-artifact@v4
39+      with:
40+        path: release-artifacts
41 
42-    - name: Upload Release Asset
43+    - name: Create GitHub Release
44       uses: softprops/action-gh-release@v2
45       with:
46-        files: ./logfmt-${{ matrix.goos }}-${{ matrix.goarch }}-${{ github.ref_name }}
47+        tag_name: ${{ github.ref_name }}
48+        name: "Release ${{ github.ref_name }}"
49+        body: |
50+          Automated release for tag ${{ github.ref_name }}.
51+        files: release-artifacts/*/*