From dae58842e5798d69235ad73b4810c59ba019d850 Mon Sep 17 00:00:00 2001 From: snowykami Date: Sat, 5 Oct 2024 06:16:55 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20=E4=BF=AE=E5=A4=8D=E5=9C=86?= =?UTF-8?q?=E8=A7=92=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bfae99f..2e2501d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build and Cross-Compile +name: Build on: push: @@ -33,22 +33,29 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Set up Go + - name: Setup Go uses: actions/setup-go@v3 with: go-version: ${{ matrix.go-version }} - - name: Auth For Private Repo + - name: Auth For Private Dependencies run: git config --global url."https://${{ secrets.GITEA_TOKEN }}@git.liteyuki.icu".insteadOf "https://git.liteyuki.icu" - name: Install dependencies run: go mod tidy - - name: Build + - name: Set environment variables + run: | + if [ "${{ matrix.os }}" == "windows" ]; then + echo "GOOS=windows" >> $GITHUB_ENV + else + echo "GOOS=linux" >> $GITHUB_ENV + fi + echo "GOARCH=${{ matrix.arch }}" >> $GITHUB_ENV + + - name: Compile run: | CGO_ENABLED=0 - GOOS=${{ matrix.os }} - GOARCH=${{ matrix.arch }} OUTPUT_NAME=server-status-server if [ "${{ matrix.os }}" == "windows" ]; then OUTPUT_NAME="${OUTPUT_NAME}.exe"; fi go build -o build/${GOOS}-${GOARCH}/${OUTPUT_NAME} main.go