diff --git a/.github/workflows/build-binary.yml b/.github/workflows/build-binary.yml index 1e3b5ee..d37a37e 100644 --- a/.github/workflows/build-binary.yml +++ b/.github/workflows/build-binary.yml @@ -20,25 +20,33 @@ jobs: needs: [test-build] strategy: matrix: - make_command: [build-client, build-tunnel] + make_command: [build-client] include: - make_command: build-client binary_name: mdrop - - make_command: build-tunnel - binary_name: mdrop-tunnel + binary_os: linux + binary_arch: amd64 uses: ./.github/workflows/reusable-build-golang-alpine.yml with: make_command: ${{ matrix.make_command }} use_artifacts: true binary_name: ${{ matrix.binary_name }} + binary_os: ${{ matrix.binary_name }} + binary_arch: ${{ matrix.binary_name }} secrets: inherit artifact-upload: needs: [artifact-build] strategy: matrix: - binary_name: [mdrop, mdrop-tunnel] + binary_name: [mdrop] + include: + - binary_name: mdrop + binary_os: linux + binary_arch: amd64 uses: ./.github/workflows/reusable-upload-s3.yml with: binary_name: ${{ matrix.binary_name }} + binary_os: ${{ matrix.binary_name }} + binary_arch: ${{ matrix.binary_name }} secrets: inherit diff --git a/.github/workflows/reusable-build-golang-alpine.yml b/.github/workflows/reusable-build-golang-alpine.yml index 9c2d23c..5a0222b 100644 --- a/.github/workflows/reusable-build-golang-alpine.yml +++ b/.github/workflows/reusable-build-golang-alpine.yml @@ -12,6 +12,12 @@ on: binary_name: type: string default: mdrop + binary_os: + type: string + default: linux + binary_arch: + type: string + default: amd64 jobs: build: @@ -28,10 +34,10 @@ jobs: apk update apk add make gcc musl-dev - name: Build app - run: make ${{ inputs.make_command }} + run: make BINARY_SUFFIX=-${{ inputs.binary_os }}-${{ inputs.binary_arch }} ${{ inputs.make_command }} - name: Upload artifacts if: ${{ inputs.use_artifacts }} uses: actions/upload-artifact@v4 with: - name: ${{ inputs.binary_name }}-build-artifact-${{ github.sha }} - path: ./${{ inputs.binary_name }} + name: ${{ inputs.binary_name }}-${{ inputs.binary_os }}-${{ inputs.binary_arch }}-artifact + path: ./${{ inputs.binary_name }}-${{ inputs.binary_os }}-${{ inputs.binary_arch }} diff --git a/.github/workflows/reusable-upload-s3.yml b/.github/workflows/reusable-upload-s3.yml index e5738dd..1142bb6 100644 --- a/.github/workflows/reusable-upload-s3.yml +++ b/.github/workflows/reusable-upload-s3.yml @@ -15,6 +15,12 @@ on: binary_name: type: string default: mdrop + binary_os: + type: string + default: linux + binary_arch: + type: string + default: amd64 jobs: upload: @@ -23,7 +29,7 @@ jobs: - name: Download artifacts uses: actions/download-artifact@v4 with: - name: ${{ inputs.binary_name }}-build-artifact-${{ github.sha }} + name: ${{ inputs.binary_name }}-${{ inputs.binary_os }}-${{ inputs.binary_arch }}-artifact - name: Check file run: | pwd diff --git a/Makefile b/Makefile index 299e0ca..f30bac9 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,18 @@ +BINARY_SUFFIX ?= "" + restore: go get -C ./cmd/mdrop-client go get -C ./cmd/mdrop-tunnel-tools go get -C ./internal build-client: restore - go build -C ./cmd/mdrop-client -ldflags="-linkmode external -extldflags -static -w -s" -o "../../mdrop" + go build -C ./cmd/mdrop-client -ldflags="-linkmode external -extldflags -static -w -s" -o "../../mdrop${BINARY_SUFFIX}" build-tunnel: restore go build -C ./cmd/mdrop-tunnel-tools -ldflags="-linkmode external -extldflags -static -w -s" -o "../../mdrop-tunnel" build-client-general: restore - go build -C ./cmd/mdrop-client -ldflags="-extldflags -static -w -s" -o "../../mdrop" + go build -C ./cmd/mdrop-client -ldflags="-extldflags -static -w -s" -o "../../mdrop${BINARY_SUFFIX}" build-tunnel-general: restore go build -C ./cmd/mdrop-tunnel-tools -ldflags="-extldflags -static -w -s" -o "../../mdrop-tunnel"