From 6301a94e926011e67e4d8d90adf02a29543d65cb Mon Sep 17 00:00:00 2001 From: fumiama Date: Tue, 9 Aug 2022 21:39:55 +0800 Subject: [PATCH] add ci --- .github/workflows/release.yml | 63 +++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..80ff61f --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,63 @@ +name: release +on: + push: + tags: + - v* + +env: + GITHUB_TOKEN: ${{ github.token }} + +jobs: + my-job: + name: Build AHSAI on Push Tag 🚀 + runs-on: ubuntu-latest + steps: + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.18 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Cache Go + id: cache + uses: actions/cache@v2 + with: + # A list of files, directories, and wildcard patterns to cache and restore + path: ~/go/pkg/mod + key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} + + - name: Tidy Go modules + run: go mod tidy + + - name: Build linux-x64 + run: CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/ahsai-linux-x64 -trimpath github.com/fumiama/ahsai/cmd + - name: Build linux-x86 + run: CGO_ENABLED=0 GOOS=linux GOARCH=386 go build -ldflags="-s -w" -o artifacts/ahsai-linux-x86 -trimpath github.com/fumiama/ahsai/cmd + - name: Build windows-x64 + run: CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o artifacts/ahsai-windows-x64.exe -trimpath github.com/fumiama/ahsai/cmd + - name: Build windows-x86 + run: CGO_ENABLED=0 GOOS=windows GOARCH=386 go build -ldflags="-s -w" -o artifacts/ahsai-windows-x86.exe -trimpath github.com/fumiama/ahsai/cmd + - name: Build arm64 + run: CGO_ENABLED=0 GOOS=linux GOARCH=arm64 GOARM=7 go build -ldflags="-s -w" -o artifacts/ahsai-linux-arm64 -trimpath github.com/fumiama/ahsai/cmd + - name: Build armv6 + run: CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 go build -ldflags="-s -w" -o artifacts/ahsai-linux-armv6 -trimpath github.com/fumiama/ahsai/cmd + - name: Build mips + run: CGO_ENABLED=0 GOOS=linux GOARCH=mips go build -ldflags="-s -w" -o artifacts/ahsai-linux-mips -trimpath github.com/fumiama/ahsai/cmd + - name: Build mips-softfloat + run: CGO_ENABLED=0 GOOS=linux GOARCH=mips GOMIPS=softfloat go build -ldflags="-s -w" -o artifacts/ahsai-linux-mips-softfloat -trimpath github.com/fumiama/ahsai/cmd + - name: Build mipsel + run: CGO_ENABLED=0 GOOS=linux GOARCH=mipsle go build -ldflags="-s -w" -o artifacts/ahsai-linux-mipsel -trimpath github.com/fumiama/ahsai/cmd + - name: Build mipsel-softfloat + run: CGO_ENABLED=0 GOOS=linux GOARCH=mipsle GOMIPS=softfloat go build -ldflags="-s -w" -o artifacts/ahsai-linux-mipsel-softfloat -trimpath github.com/fumiama/ahsai/cmd + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: artifacts/ahsai-* + tag: ${{ github.ref }} + overwrite: true + file_glob: true \ No newline at end of file