feat: ci release go binaries

This commit is contained in:
lapwat
2022-07-27 12:30:35 +02:00
parent 6d795f3033
commit 2683e8266e
3 changed files with 20 additions and 27 deletions

18
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,18 @@
on:
release:
types: [created]
jobs:
releases-matrix:
name: Release Go Binary
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, darwin, windows]
steps:
- uses: actions/checkout@v3
- uses: wangyoucao577/go-release-action@v1.30
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
goos: ${{ matrix.goos }}
goarch: amd64

View File

@@ -4,6 +4,8 @@ on:
push:
paths:
- '**.go'
- 'go.mod'
- 'go.sum'
jobs:
test:

View File

@@ -1,27 +0,0 @@
#!/usr/bin/env bash
if [ "$#" -ne 1 ]; then
echo "Illegal number of parameters"
echo "Usage: ./release.sh X.X.X"
exit 1
fi
version=$1
platforms=("linux/amd64" "darwin/amd64" "windows/amd64")
for platform in "${platforms[@]}"
do
platform_split=(${platform//\// })
GOOS=${platform_split[0]}
GOARCH=${platform_split[1]}
if [ $GOOS = "windows" ]; then
env GOOS=$GOOS GOARCH=$GOARCH go build -o papeer.exe
zip "papeer-v$version-$GOOS-$GOARCH.exe.zip" papeer.exe
rm papeer.exe
else
env GOOS=$GOOS GOARCH=$GOARCH go build -o papeer
tar czvf "papeer-v$version-$GOOS-$GOARCH.tar.gz" papeer
rm papeer
fi
done