binaries for arm

This commit is contained in:
Ilya Sosnovsky 2021-10-21 09:56:29 +03:00
parent 4c5423169d
commit c1173798c1
6 changed files with 45 additions and 6 deletions

View File

@ -1,6 +1,5 @@
# .github/workflows/release.yaml
on:
name: Build and publish binaries (releases only)
on:
release:
types: [created]
@ -10,7 +9,6 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
# build and publish in parallel: linux/386, linux/amd64, windows/386, windows/amd64, darwin/386, darwin/amd64
goos: [linux]
goarch: ["386", amd64]
steps:

28
.github/workflows/release_arm.yaml vendored Normal file
View File

@ -0,0 +1,28 @@
name: Build and publish arm binaries (releases only)
on:
release:
types: [created]
jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
env:
CGO_ENABLED: 1
strategy:
matrix:
goos: [linux]
goarch: ["arm", "arm64"]
steps:
- name: checkout code
uses: actions/checkout@v2
- name: build binaries
uses: wangyoucao577/go-release-action@v1.20
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: ${{ matrix.goarch }}
build_command: bash ./build_arm.sh
pre_command: bash ./install-deps_arm.sh
binary_name: "openvpn-user-${{ matrix.goarch }}"
asset_name: openvpn-user-${{ matrix.goos }}-${{ matrix.goarch }}.

10
build_arm.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
if [[ "$GOOS" == "linux" ]]; then
if [[ "$GOARCH" == "arm" ]]; then
CC=arm-linux-gnueabi-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm go build -ldflags "-linkmode external -extldflags -static -s -w" -o openvpn-user-arm
fi
if [[ "$GOARCH" == "arm64" ]]; then
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-linkmode external -extldflags -static -s -w" -o openvpn-user-arm64
fi
fi

4
install-deps-arm.sh Executable file
View File

@ -0,0 +1,4 @@
#!/usr/bin/env bash
apt-get update
apt-get install -y gcc gcc-multilib sqlite3 libc6-dev-arm64-cross gcc-arm-linux-gnueabi gcc-aarch64-linux-gnu

View File

@ -1,5 +1,4 @@
#!/usr/bin/env bash
set -e
apt-get update
apt-get install -y gcc gcc-multilib sqlite3

View File

@ -11,7 +11,7 @@ import (
)
const (
version = "1.0.3-rc.1"
version = "1.0.3"
)
var (