|
1 | 1 | name: Build and Release |
2 | 2 |
|
3 | 3 | on: |
4 | | - # push: |
5 | | - # branches: [main] |
6 | | - # paths: |
7 | | - # - "**.go" # Only run on changes to Go files |
8 | | - # - "go.mod" # Or changes to dependencies |
9 | | - # - "go.sum" |
10 | | - # # Excludes changes to docs, workflows, etc. |
11 | | - # tags-ignore: |
12 | | - # - "v*" # Avoid running this workflow when tagging (prevents circular triggers) |
13 | | - workflow_dispatch: # Manual trigger |
14 | 4 |
|
15 | 5 | jobs: |
16 | 6 | build: |
17 | 7 | runs-on: ubuntu-latest |
18 | 8 | steps: |
19 | 9 | - uses: actions/checkout@v3 |
20 | | - |
21 | | - - name: Set up Go |
22 | | - uses: actions/setup-go@v4 |
23 | | - with: |
24 | | - go-version: "1.23" |
25 | | - |
26 | | - - name: Build |
27 | | - run: | |
28 | | - cd go-tui |
29 | | - mkdir -p build |
30 | | - # -ldflags="-s -w" removes debug information and symbol tables |
31 | | - # -trimpath removes file system paths from the binary |
32 | | - GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o build/anitrack-cli-windows-amd64.exe |
33 | | - GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -trimpath -o build/anitrack-cli-linux-amd64 |
34 | | - GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -trimpath -o build/anitrack-cli-macos-arm64 |
35 | | -
|
36 | | - - name: Install UPX |
37 | | - run: | |
38 | | - sudo apt-get update |
39 | | - sudo apt-get install -y upx |
40 | | -
|
41 | | - - name: Compress binaries |
42 | | - run: | |
43 | | - upx --best --lzma build/anitrack-cli-windows-amd64.exe |
44 | | - upx --best --lzma build/anitrack-cli-linux-amd64 |
45 | | - # Skip macOS binaries as UPX can cause issues with code signing |
46 | | -
|
47 | | - - name: Create Release |
48 | | - id: create_release |
49 | | - uses: softprops/action-gh-release@v1 |
50 | | - with: |
51 | | - files: | |
52 | | - build/anitrack-cli-windows-amd64.exe |
53 | | - build/anitrack-cli-linux-amd64 |
54 | | - build/anitrack-cli-macos-arm64 |
55 | | - tag_name: v0.1.${{ github.run_number }} |
56 | | - name: Release v0.1.${{ github.run_number }} |
57 | | - draft: false |
58 | | - prerelease: false |
59 | | - env: |
60 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments