From 8435d283f90253185cb5ee25ec1eb61d5db66ff3 Mon Sep 17 00:00:00 2001 From: nullcat Date: Mon, 25 May 2026 00:15:29 +0800 Subject: [PATCH] chore(ci): add GitHub Actions workflow for cross-platform Go build --- .github/workflows/build.yml | 45 +++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a413e69 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: Build + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + runs-on: ubuntu-latest + strategy: + matrix: + goos: [linux, windows, darwin] + goarch: [amd64, arm64] + steps: + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: '1.26.3' + cache: true + + - name: Install dependencies + run: go mod download + + - name: Build + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + run: | + DATE=$(date +'%y%m%d') + BINARY_NAME="tslink-dev${DATE}-${{ matrix.goos }}_${{ matrix.goarch }}" + if [ "${{ matrix.goos }}" = "windows" ]; then + BINARY_NAME="${BINARY_NAME}.exe" + fi + go build -v -o "release/${BINARY_NAME}" . + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: tslink-${{ matrix.goos }}-${{ matrix.goarch }} + path: release/