Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Commit

Permalink
rewrite github action script
Browse files Browse the repository at this point in the history
  • Loading branch information
boypt committed May 6, 2021
1 parent a087c55 commit ee6c4f1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 79 deletions.
31 changes: 9 additions & 22 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,25 @@ jobs:
- name: Get dependencies
run: |
go get -v -u github.com/shuLhan/go-bindata/...
go get -v -t -d ./...
- name: Build
run: |
#bash scripts/ci_release.sh windows amd64
#bash scripts/ci_release.sh windows 386
bash scripts/ci_release.sh linux amd64
bash scripts/ci_release.sh linux 386
bash scripts/ci_release.sh linux arm64
# bash scripts/ci_release.sh linux arm
# bash scripts/ci_release.sh linux mipsle
# bash scripts/ci_release.sh linux mips
# bash scripts/ci_release.sh darwin amd64
bash scripts/make_release.sh gzip amd64
bash scripts/make_release.sh gzip amd64 purego
bash scripts/make_release.sh gzip arm64
bash scripts/make_release.sh gzip arm64 purego
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
#scripts/build/cloud-torrent_windows_amd64.exe.gz
#scripts/build/cloud-torrent_windows_386.exe.gz
scripts/build/cloud-torrent_linux_amd64.gz
scripts/build/cloud-torrent_linux_386.gz
scripts/build/cloud-torrent_linux_arm64.gz
# scripts/build/cloud-torrent_linux_arm_armv5.gz
# scripts/build/cloud-torrent_linux_arm_armv6.gz
# scripts/build/cloud-torrent_linux_arm_armv7.gz
# scripts/build/cloud-torrent_linux_mipsle.gz
# scripts/build/cloud-torrent_linux_mips.gz
# scripts/build/cloud-torrent_darwin_amd64.gz
prerelease: false
cloud-torrent_linux_amd64.gz
cloud-torrent_linux_amd64_static.gz
cloud-torrent_linux_arm64.gz
cloud-torrent_linux_arm64_static.gz
prerelease: true
draft: false
body_path: gittaglogs.txt
env:
Expand Down
46 changes: 0 additions & 46 deletions scripts/ci_release.sh

This file was deleted.

29 changes: 18 additions & 11 deletions scripts/make_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,38 @@ GITVER=$(git describe --tags)

OS=""
ARCH=""
EXESUFFIX=""
SUFFIX=""
PKGCMD=
NOSTATIC=
CGO=1

for arg in "$@"; do
case $arg in
amd64)
ARCH=amd64
;;
arm64)
ARCH=arm64
;;
386)
GOARCH=386
ARCH=386
;;
windows)
OS=windows
EXESUFFIX=.exe
SUFFIX=.exe
;;
xz)
PKGCMD=xz
;;
;;
nostat)
NOSTATIC=1
;;
;;
gzip)
PKGCMD=gzip
;;
purego)
CGO=0
EXESUFFIX=_static
SUFFIX=_static
;;
esac
done
Expand All @@ -56,15 +62,16 @@ fi

pushd $__dir/..
BINFILE=${BIN}_${OS}_${ARCH}${SUFFIX}
rm -fv ${BIN}_*
CGO_ENABLED=$CGO GOARCH=$ARCH GOOS=$OS go build -o ${BINFILE}${EXESUFFIX} -trimpath -ldflags "-s -w -X main.VERSION=$GITVER"
if [[ ! -f ${BINFILE}${EXESUFFIX} ]]; then
CGO_ENABLED=$CGO GOARCH=$ARCH GOOS=$OS go build -o ${BINFILE} -trimpath -ldflags "-s -w -X main.VERSION=$GITVER"
if [[ ! -f ${BINFILE} ]]; then
echo "Build failed. Check with error message above."
exit 1
fi

git checkout HEAD -- static/*
if [[ -z $NOSTATIC ]]; then
git checkout HEAD -- static/*
fi

if [[ ! -z $PKGCMD ]]; then
${PKGCMD} -v -9 -k ${BINFILE}${EXESUFFIX}
${PKGCMD} -v -9 ${BINFILE}
fi

0 comments on commit ee6c4f1

Please sign in to comment.