Build updater #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build updater | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| build-backend-linux: | |
| name: "Build updater for linux" | |
| runs-on: ubuntu-latest | |
| # Runs on alpine because it is easier to statically link the library | |
| container: | |
| image: golang:alpine | |
| env: | |
| UPDATER_DIR: ./updater | |
| steps: | |
| - name: "Install packages" | |
| run: apk update && apk add --no-cache gcc go | |
| - uses: actions/checkout@v4 | |
| with: | |
| sparse-checkout: updater | |
| - name: "Create output path" | |
| working-directory: "${{env.UPDATER_DIR}}" | |
| run: mkdir ./output | |
| - name: "Build (64 bit)" | |
| working-directory: "${{env.UPDATER_DIR}}" | |
| env: | |
| CGO_ENABLED: 1 | |
| GOARCH: amd64 | |
| GOOS: linux | |
| run: | | |
| go build -ldflags '-linkmode external -extldflags "-static"' -o ../output/updaters/updater-linux-64 | |
| - name: "Upload build" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: updater-linux | |
| path: "${{env.UPDATER_DIR}}/output/updater/*" | |
| retention-days: 3 | |
| compression-level: 9 | |
| build-backend-windows: | |
| name: "Build updater for windows" | |
| runs-on: windows-latest | |
| env: | |
| UPDATER_DIR: ".\\updater" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: "Setup Go" | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.21.3" | |
| cache-dependency-path: "${{env.UPDATER_DIR}}\\go.sum" | |
| - name: "Create output path" | |
| working-directory: "${{env.UPDATER_DIR}}" | |
| run: mkdir .\output | |
| - name: "Build (64 bit)" | |
| working-directory: "${{env.UPDATER_DIR}}" | |
| env: | |
| CGO_ENABLED: 1 | |
| GOARCH: amd64 | |
| GOOS: windows | |
| run: | | |
| go build -o ..\output\backend-windows-64.exe | |
| - name: "Upload build" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: updater-windows | |
| path: "${{env.UPDATER_DIR}}\\output\\updater\\*" | |
| retention-days: 3 | |
| compression-level: 9 | |
| build-backend-mac: | |
| name: "Build updater for macOS" | |
| runs-on: macos-latest | |
| env: | |
| BACKEND_DIR: ./updater | |
| steps: | |
| - name: "Setup Go" | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.21.3" | |
| cache-dependency-path: "${{env.UPDATER_DIR}}/go.sum" | |
| - uses: actions/checkout@v3 | |
| - name: "Create output path" | |
| working-directory: "${{env.UPDATER_DIR}}" | |
| run: mkdir ./output | |
| - name: "Build (64 bit)" | |
| working-directory: "${{env.UPDATER_DIR}}" | |
| env: | |
| CGO_ENABLED: 1 | |
| GOARCH: amd64 | |
| GOOS: darwin | |
| run: | | |
| go build -o ../output/updater-macos-64 | |
| - name: "Build (apple 64 bit)" | |
| working-directory: "${{env.UPDATER_DIR}}/cmd" | |
| env: | |
| CGO_ENABLED: 1 | |
| GOARCH: arm64 | |
| GOOS: darwin | |
| run: | | |
| go build -o ../output/updater-macos-m1-64 | |
| - name: "Upload build" | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: updater-macos | |
| path: "${{env.BACKEND_DIR}}/output/*" | |
| retention-days: 3 | |
| compression-level: 9 |