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/bin go build -o "dist/bin/${BINARY_NAME}" . - name: Package binary only run: | cd dist/bin tar -czf "../${BINARY_NAME}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz" "${BINARY_NAME}" - name: Upload binary artifact uses: actions/upload-artifact@v4 with: name: ${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }} path: dist/${{ env.BINARY_NAME }}_${{ matrix.goos }}_${{ matrix.goarch }}.tar.gz 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 artifact uses: actions/upload-artifact@v4 with: name: source_tarball path: dist/*source.tar.gz publish: runs-on: ubuntu-latest needs: [build, source] permissions: contents: write steps: - name: Download artifacts uses: actions/download-artifact@v4 with: path: dist merge-multiple: true - name: Publish assets to GitHub Release uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} files: dist/*