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