name: release on: push: tags: - 'v*.*.*' - 'v*.*.*-*' permissions: contents: write jobs: build: name: Build (${{ matrix.os }}/${{ matrix.arch }}) runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - os: linux arch: amd64 ext: '' - os: linux arch: arm64 ext: '' - os: darwin arch: amd64 ext: '' - os: darwin arch: arm64 ext: '' - os: windows arch: amd64 ext: '.exe' - os: windows arch: arm64 ext: '.exe' steps: - name: Checkout uses: actions/checkout@v5 with: fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v7 with: go-version: '1.26' cache: true - name: Build binary env: VERSION: ${{ github.ref_name }} run: | set -euo pipefail mkdir -p dist OUT="dist/rony-llm-agent-${VERSION}-${{ matrix.os }}-${{ matrix.arch }}${{ matrix.ext }}" GOOS=${{ matrix.os }} GOARCH=${{ matrix.arch }} \ go build -trimpath \ -ldflags "-s -w -X main.version=${VERSION}" \ -o "$OUT" \ ./cmd/rony-llm-agent echo "Built $OUT" ls -lh "$OUT" - name: Upload artifact uses: actions/upload-artifact@v4 with: name: rony-llm-agent-${{ matrix.os }}-${{ matrix.arch }} path: dist/rony-llm-agent-* if-no-files-found: error release: name: Publish release needs: build runs-on: ubuntu-latest permissions: contents: write steps: - name: Download all artifacts uses: actions/download-artifact@v4 with: path: dist - name: Flatten artifacts run: | mkdir -p release find dist -type f -name 'rony-llm-agent-*' -exec mv {} release/ \; ls -lh release/ - name: Generate checksums run: | cd release sha256sum * > SHA256SUMS ls -lh - name: Create GitHub release uses: softprops/action-gh-release@v2 with: name: ${{ github.ref_name }} prerelease: ${{ contains(github.ref_name, '-') }} generate_release_notes: true files: | release/*