name: Build release binaries on: push: tags: - "v*" permissions: contents: write env: BINARY_NAME: streamed-tui jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: include: - goos: linux goarch: amd64 - goos: linux goarch: arm64 - goos: darwin goarch: amd64 - goos: darwin goarch: arm64 steps: - name: Checkout repository uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version-file: go.mod cache: true - name: Build ${{ matrix.goos }}_${{ matrix.goarch }} env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} CGO_ENABLED: 0 run: | mkdir -p dist outfile="${BINARY_NAME}_${{ matrix.goos }}_${{ matrix.goarch }}" go build -o "dist/${outfile}" . - name: Upload binary uses: actions/upload-artifact@v4 with: name: binaries_${{ matrix.goos }}_${{ matrix.goarch }} path: dist/${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }} if-no-files-found: error source: runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 with: fetch-depth: 0 - name: Create source tarball run: | mkdir -p dist tag="${GITHUB_REF_NAME}" tar -czf "dist/${{ env.BINARY_NAME }}_${tag}_source.tar.gz" . - name: Upload source uses: actions/upload-artifact@v4 with: name: source path: dist/*source.tar.gz publish: runs-on: ubuntu-latest needs: [build, source] permissions: contents: write steps: - name: Download all artifacts flat uses: actions/download-artifact@v4 with: path: dist merge-multiple: true - name: Publish to GitHub release uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} files: dist/*