|
1 | 1 | name: Build updater |
2 | 2 |
|
| 3 | +permissions: |
| 4 | + contents: read |
| 5 | + |
3 | 6 | on: |
4 | 7 | workflow_dispatch: |
5 | 8 | pull_request: |
|
8 | 11 |
|
9 | 12 | jobs: |
10 | 13 | build-updater-linux: |
11 | | - name: "Build updater for Linux" |
| 14 | + name: Build updater for Linux |
12 | 15 | runs-on: ubuntu-latest |
13 | 16 |
|
14 | | - container: |
15 | | - image: golang:alpine |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v4 |
| 19 | + |
| 20 | + - name: Set up Go (v4, with module caching) |
| 21 | + uses: actions/setup-go@v4 |
| 22 | + with: |
| 23 | + go-version: '1.21.3' |
| 24 | + cache: modules |
16 | 25 |
|
17 | | - env: |
18 | | - UPDATER_DIR: ./updater |
| 26 | + - name: Create output dir |
| 27 | + run: mkdir -p updater/output |
19 | 28 |
|
20 | | - steps: |
21 | | - - name: Install packages (incl. git!) |
22 | | - run: | |
23 | | - apk update |
24 | | - apk add --no-cache gcc go git |
25 | | -
|
26 | | - - uses: actions/checkout@v4 |
27 | | - |
28 | | - - name: Create output path |
29 | | - working-directory: ${{ env.UPDATER_DIR }} |
30 | | - run: mkdir -p output |
31 | | - |
32 | | - - name: Build (64-bit Linux) |
33 | | - working-directory: ${{ env.UPDATER_DIR }} |
34 | | - env: |
35 | | - CGO_ENABLED: 1 |
36 | | - GOARCH: amd64 |
37 | | - GOOS: linux |
38 | | - run: | |
39 | | - go build -ldflags '-linkmode external -extldflags "-static"' \ |
40 | | - -o output/updater-linux-64 |
41 | | -
|
42 | | - - name: Upload Linux build |
43 | | - uses: actions/upload-artifact@v4 |
44 | | - with: |
45 | | - name: updater-linux |
46 | | - path: ${{ env.UPDATER_DIR }}/output/* |
47 | | - retention-days: 3 |
48 | | - compression-level: 9 |
| 29 | + - name: Build (Linux amd64) |
| 30 | + run: | |
| 31 | + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 \ |
| 32 | + go build -o updater/output/updater-linux-64 ./updater |
| 33 | +
|
| 34 | + - name: Upload Linux artifact |
| 35 | + uses: actions/upload-artifact@v4 |
| 36 | + with: |
| 37 | + name: updater-linux |
| 38 | + path: updater/output/* |
49 | 39 |
|
50 | 40 | build-updater-windows: |
51 | | - name: "Build updater for Windows" |
| 41 | + name: Build updater for Windows |
52 | 42 | runs-on: windows-latest |
53 | 43 |
|
54 | | - env: |
55 | | - UPDATER_DIR: .\\updater |
56 | | - |
57 | 44 | steps: |
58 | | - - uses: actions/checkout@v3 |
59 | | - |
60 | | - - name: Setup Go (with cache) |
61 | | - uses: actions/setup-go@v4 |
62 | | - with: |
63 | | - go-version: "1.21.3" |
64 | | - cache-dependency-path: updater\\go.sum |
65 | | - |
66 | | - - name: Create output path |
67 | | - working-directory: ${{ env.UPDATER_DIR }} |
68 | | - run: mkdir output |
69 | | - |
70 | | - - name: Build (64-bit Windows) |
71 | | - working-directory: ${{ env.UPDATER_DIR }} |
72 | | - env: |
73 | | - CGO_ENABLED: 1 |
74 | | - GOARCH: amd64 |
75 | | - GOOS: windows |
76 | | - run: go build -o output\\updater-windows-64.exe |
77 | | - |
78 | | - - name: Upload Windows build |
79 | | - uses: actions/upload-artifact@v4 |
80 | | - with: |
81 | | - name: updater-windows |
82 | | - path: ${{ env.UPDATER_DIR }}\\output\\* |
83 | | - retention-days: 3 |
84 | | - compression-level: 9 |
| 45 | + - uses: actions/checkout@v4 |
| 46 | + |
| 47 | + - name: Set up Go (v4, with module caching) |
| 48 | + uses: actions/setup-go@v4 |
| 49 | + with: |
| 50 | + go-version: '1.21.3' |
| 51 | + cache: modules |
| 52 | + |
| 53 | + - name: Create output dir |
| 54 | + shell: pwsh |
| 55 | + run: New-Item -ItemType Directory -Path updater\output -Force |
| 56 | + |
| 57 | + - name: Build (Windows amd64) |
| 58 | + shell: pwsh |
| 59 | + run: | |
| 60 | + $Env:CGO_ENABLED = '0' |
| 61 | + go build -o updater\output\updater-windows-64.exe ./updater |
| 62 | +
|
| 63 | + - name: Upload Windows artifact |
| 64 | + uses: actions/upload-artifact@v4 |
| 65 | + with: |
| 66 | + name: updater-windows |
| 67 | + path: updater\output\* |
85 | 68 |
|
86 | 69 | build-updater-mac: |
87 | | - name: "Build updater for macOS" |
| 70 | + name: Build updater for macOS |
88 | 71 | runs-on: macos-latest |
89 | 72 |
|
90 | | - env: |
91 | | - UPDATER_DIR: ./updater |
92 | | - |
93 | 73 | steps: |
94 | | - - uses: actions/checkout@v3 |
95 | | - |
96 | | - - name: Setup Go (with cache) |
97 | | - uses: actions/setup-go@v4 |
98 | | - with: |
99 | | - go-version: "1.21.3" |
100 | | - cache-dependency-path: updater/go.sum |
101 | | - |
102 | | - - name: Create output path |
103 | | - working-directory: ${{ env.UPDATER_DIR }} |
104 | | - run: mkdir -p output |
105 | | - |
106 | | - - name: Build (Intel macOS) |
107 | | - working-directory: ${{ env.UPDATER_DIR }} |
108 | | - env: |
109 | | - CGO_ENABLED: 1 |
110 | | - GOARCH: amd64 |
111 | | - GOOS: darwin |
112 | | - run: go build -o output/updater-macos-64 |
113 | | - |
114 | | - - name: Build (Apple Silicon) |
115 | | - working-directory: ${{ env.UPDATER_DIR }} |
116 | | - env: |
117 | | - CGO_ENABLED: 1 |
118 | | - GOARCH: arm64 |
119 | | - GOOS: darwin |
120 | | - run: go build -o output/updater-macos-m1-64 |
121 | | - |
122 | | - - name: Upload macOS build |
123 | | - uses: actions/upload-artifact@v4 |
124 | | - with: |
125 | | - name: updater-macos |
126 | | - path: ${{ env.UPDATER_DIR }}/output/* |
127 | | - retention-days: 3 |
128 | | - compression-level: 9 |
| 74 | + - uses: actions/checkout@v4 |
| 75 | + |
| 76 | + - name: Set up Go (v4, with module caching) |
| 77 | + uses: actions/setup-go@v4 |
| 78 | + with: |
| 79 | + go-version: '1.21.3' |
| 80 | + cache: modules |
| 81 | + |
| 82 | + - name: Create output dir |
| 83 | + run: mkdir -p updater/output |
| 84 | + |
| 85 | + - name: Build (macOS Intel) |
| 86 | + run: | |
| 87 | + CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 \ |
| 88 | + go build -o updater/output/updater-macos-64 ./updater |
| 89 | +
|
| 90 | + - name: Build (macOS ARM64) |
| 91 | + run: | |
| 92 | + CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 \ |
| 93 | + go build -o updater/output/updater-macos-m1-64 ./updater |
| 94 | +
|
| 95 | + - name: Upload macOS artifact |
| 96 | + uses: actions/upload-artifact@v4 |
| 97 | + with: |
| 98 | + name: updater-macos |
| 99 | + path: updater/output/* |
0 commit comments