diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1bd2576..2b36feb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,26 +1,36 @@ -name: Build Binaries +name: Release on: workflow_dispatch: - push: - tags: - - '[0-9]+.[0-9]+.[0-9]+' + release: + types: [created] + +permissions: + contents: write + packages: write + jobs: - build: - name: Build + releases-matrix: + name: Release Go Binary runs-on: ubuntu-latest + strategy: + matrix: + # build and publish in parallel: linux/386, linux/amd64, linux/arm64, windows/386, windows/amd64, darwin/amd64, darwin/arm64 + goos: [linux, windows, darwin] + goarch: ["386", amd64, arm64] + exclude: + - goarch: "386" + goos: darwin + - goarch: arm64 + goos: windows steps: - - name: Set up Golang - uses: actions/setup-go@v5 - with: - go-version: "1.22" - - name: Checkout - uses: actions/checkout@v4 - - name: Compile binaries - run: make build - - name: Upload binaries - uses: actions/upload-artifact@v4 - with: - name: binaries - path: lite-reader-* - if-no-files-found: error - retention-days: 5 + - uses: actions/checkout@v4 + - uses: wangyoucao577/go-release-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.goos }} + goarch: ${{ matrix.goarch }} + goversion: "https://go.dev/dl/go1.22.0.linux-amd64.tar.gz" + pre_command: export CGO_ENABLED=1 + project_path: "./cmd" + binary_name: "lite-reader" + extra_files: README.md public