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