From da0561c3d0fe75181c57cc35ad5e746b47ff3c7c Mon Sep 17 00:00:00 2001 From: Paul Hendryx Date: Tue, 27 Dec 2022 16:17:23 -0500 Subject: [PATCH] testing workflows --- .github/workflows/main.yml | 41 ++++++++++++++++++++++++++++++++++++++ scripts/build-darwin.sh | 2 +- scripts/build-linux.sh | 6 ++++-- scripts/build-windows.sh | 6 +++++- 4 files changed, 51 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..ffab6a8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,41 @@ +# .github/workflows/release.yaml + +on: + release: + types: [created] + +jobs: + build-linux: + name: Build on Linux + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.16 + - name: Build + run: make build-linux + - uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: update-linux-amd64.gz +build-windows: + name: Build on Windows + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.16 + - name: Build + run: make build-windows + - uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: update-windows-amd64.exe.gz + - uses: shogo82148/actions-upload-release-asset@v1 + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: albiondata-client-amd64-installer.exe diff --git a/scripts/build-darwin.sh b/scripts/build-darwin.sh index 2292a34..87acd00 100755 --- a/scripts/build-darwin.sh +++ b/scripts/build-darwin.sh @@ -10,7 +10,7 @@ export CC=/usr/osxcross/bin/o64-clang export CXX=/usr/osxcross/bin/o64-clang++ export GOOS=darwin export GOARCH=amd64 CGO_ENABLED=1 -go build -ldflags "-s -w -X main.version=$CIRCLE_TAG" albiondata-client.go +go build -ldflags "-s -w -X main.version=$GITHUB_REF_NAME" albiondata-client.go gzip -k9 albiondata-client diff --git a/scripts/build-linux.sh b/scripts/build-linux.sh index 3280523..22794f0 100755 --- a/scripts/build-linux.sh +++ b/scripts/build-linux.sh @@ -2,9 +2,11 @@ set -eo pipefail -sudo apt-get install -y libpcap-dev +sudo apt-get update && apt-get install -y libpcap-dev -go build -ldflags "-s -w -X main.version=$CIRCLE_TAG" albiondata-client.go +go build -ldflags "-s -w -X main.version=$GITHUB_REF_NAME" albiondata-client.go +ls -la gzip -9 albiondata-client mv albiondata-client.gz update-linux-amd64.gz +ls -la \ No newline at end of file diff --git a/scripts/build-windows.sh b/scripts/build-windows.sh index 09f7a89..744e393 100755 --- a/scripts/build-windows.sh +++ b/scripts/build-windows.sh @@ -2,6 +2,10 @@ set -eo pipefail +GITHUB_REF_NAME=1.2.3 + +sudo apt update && sudo apt install -y nsis nsis-pluginapi + export CGO_CPPFLAGS="-I $GOPATH/src/github.com/broderickhyman/albiondata-client/thirdparty/WpdPack/Include/" export CGO_LDFLAGS="-L $GOPATH/src/github.com/broderickhyman/albiondata-client/thirdparty/WpdPack/Lib/x64/" export GOOS=windows @@ -9,7 +13,7 @@ export GOARCH=amd64 export CGO_ENABLED=1 export CXX=x86_64-w64-mingw32-g++ export CC=x86_64-w64-mingw32-gcc -go build -ldflags "-s -w -X main.version=$CIRCLE_TAG" -o albiondata-client.exe -v -x albiondata-client.go +go build -ldflags "-s -w -X main.version=$GITHUB_REF_NAME" -o albiondata-client.exe -v -x albiondata-client.go # Add icon to the .exe wine thirdparty/rcedit/rcedit.exe albiondata-client.exe --set-icon icon/albiondata-client.ico