name: Release on: push: tags: - 'v*.*.*' jobs: create-release: name: Create Release runs-on: ubuntu-latest container: catthehacker/ubuntu:act-latest outputs: upload_url: ${{ steps.create_release.outputs.upload_url }} steps: - name: Create Release id: create_release uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: tag_name: ${{ github.ref_name }} release_name: Release ${{ github.ref_name }} body: | ## What's Changed See [CHANGELOG.md](./CHANGELOG.md) for details. ## Installation Download the appropriate binary for your platform below. ### Docker ```bash docker pull gitea.example.com/${{ github.repository }}:${{ github.ref_name }} ``` ### Verification Verify your download with the provided SHA256 checksums. draft: false prerelease: false build-and-upload: name: Build and Upload Assets needs: create-release runs-on: ubuntu-latest container: catthehacker/ubuntu:act-latest strategy: matrix: include: - goos: linux goarch: amd64 - goos: linux goarch: 386 - goos: linux goarch: arm64 - goos: linux goarch: arm goarm: 7 - goos: windows goarch: amd64 - goos: windows goarch: 386 - goos: darwin goarch: amd64 - goos: darwin goarch: arm64 steps: - name: Checkout code uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v5 with: go-version: '1.21' - name: Build binary env: GOOS: ${{ matrix.goos }} GOARCH: ${{ matrix.goarch }} GOARM: ${{ matrix.goarm }} run: | BINARY_NAME="linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}" if [ "${{ matrix.goarm }}" != "" ]; then BINARY_NAME="${BINARY_NAME}v${{ matrix.goarm }}" fi if [ "${{ matrix.goos }}" = "windows" ]; then BINARY_NAME="${BINARY_NAME}.exe" fi go build -o "${BINARY_NAME}" \ -ldflags="-s -w -X main.Version=${{ github.ref_name }} -X main.Commit=${{ github.sha }}" \ ./cmd/linkbeam # Create tarball (except for Windows) if [ "${{ matrix.goos }}" != "windows" ]; then tar -czf "${BINARY_NAME}.tar.gz" "${BINARY_NAME}" sha256sum "${BINARY_NAME}.tar.gz" > "${BINARY_NAME}.tar.gz.sha256" rm "${BINARY_NAME}" else zip "${BINARY_NAME}.zip" "${BINARY_NAME}" sha256sum "${BINARY_NAME}.zip" > "${BINARY_NAME}.zip.sha256" rm "${BINARY_NAME}" fi - name: Upload Release Asset (tar.gz) if: matrix.goos != 'windows' uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} asset_path: ./linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}.tar.gz asset_name: linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}.tar.gz asset_content_type: application/gzip - name: Upload Release Asset (zip) if: matrix.goos == 'windows' uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} asset_path: ./linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}.exe.zip asset_name: linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}.zip asset_content_type: application/zip - name: Upload Checksum uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.create-release.outputs.upload_url }} asset_path: ./linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}${{ matrix.goos == 'windows' && '.exe.zip.sha256' || '.tar.gz.sha256' }} asset_name: linkbeam-${{ matrix.goos }}-${{ matrix.goarch }}${{ matrix.goarm && format('v{0}', matrix.goarm) || '' }}${{ matrix.goos == 'windows' && '.zip.sha256' || '.tar.gz.sha256' }} asset_content_type: text/plain