-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: [master] | ||
paths: | ||
- "**/*.go" | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version-file: "path/to/go.mod" | ||
|
||
- name: Build | ||
run: ./build.sh | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: build | ||
path: build/releases |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#!/bin/bash | ||
|
||
BUILD_DIR=$(dirname "$0")/build/releases | ||
mkdir -p $BUILD_DIR | ||
cd $BUILD_DIR | ||
|
||
sum="sha256sum" | ||
VERSION=$(git describe --tags --always --dirty) | ||
|
||
# AMD64 | ||
OSES=(linux darwin windows freebsd) | ||
for os in ${OSES[@]}; do | ||
suffix="" | ||
if [ "$os" == "windows" ] | ||
then | ||
suffix=".exe" | ||
fi | ||
env GOOS=$os GOARCH=amd64 go build -o azukiiro_${os}_amd64${suffix} github.com/zhzxdev/azukiiro | ||
tar -zcf azukiiro-${os}-amd64-$VERSION.tar.gz azukiiro_${os}_amd64${suffix} | ||
rm azukiiro_${os}_amd64${suffix} | ||
HASH=$($sum azukiiro-${os}-amd64-$VERSION.tar.gz) | ||
echo "$HASH azukiiro-${os}-amd64-$VERSION.tar.gz" > azukiiro-$VERSION.sha256 | ||
done | ||
|
||
# 386 | ||
OSES=(linux windows) | ||
for os in ${OSES[@]}; do | ||
suffix="" | ||
if [ "$os" == "windows" ] | ||
then | ||
suffix=".exe" | ||
fi | ||
env GOOS=$os GOARCH=386 go build -o azukiiro_${os}_386${suffix} github.com/zhzxdev/azukiiro | ||
tar -zcf azukiiro-${os}-386-$VERSION.tar.gz azukiiro_${os}_386${suffix} | ||
rm azukiiro_${os}_386${suffix} | ||
HASH=$($sum azukiiro-${os}-386-$VERSION.tar.gz) | ||
echo "$HASH azukiiro-${os}-386-$VERSION.tar.gz" > azukiiro-$VERSION.sha256 | ||
done | ||
|
||
# ARM | ||
ARMS=(5 6 7) | ||
for v in ${ARMS[@]}; do | ||
env GOOS=linux GOARCH=arm GOARM=$v go build -o azukiiro_linux_arm$v github.com/zhzxdev/azukiiro | ||
tar -zcf azukiiro-linux-arm$v-$VERSION.tar.gz azukiiro_linux_arm$v | ||
rm azukiiro_linux_arm$v | ||
HASH=$($sum azukiiro-linux-arm$v-$VERSION.tar.gz) | ||
echo "$HASH azukiiro-linux-arm$v-$VERSION.tar.gz" > azukiiro-$VERSION.sha256 | ||
done | ||
|
||
# ARM64 | ||
OSES=(linux darwin windows) | ||
for os in ${OSES[@]}; do | ||
suffix="" | ||
if [ "$os" == "windows" ] | ||
then | ||
suffix=".exe" | ||
fi | ||
env GOOS=$os GOARCH=arm64 go build -o azukiiro_${os}_arm64${suffix} github.com/zhzxdev/azukiiro | ||
tar -zcf azukiiro-${os}-arm64-$VERSION.tar.gz azukiiro_${os}_arm64${suffix} | ||
rm azukiiro_${os}_arm64${suffix} | ||
HASH=$($sum azukiiro-${os}-arm64-$VERSION.tar.gz) | ||
echo "$HASH azukiiro-${os}-arm64-$VERSION.tar.gz" > azukiiro-$VERSION.sha256 | ||
done |