Release #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| # Builds and packages tagged releases. Push a tag like `v0.1.0` to produce | |
| # a prebuilt binary tarball and a GitHub Release. | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Version tag to build (e.g. v0.1.0)' | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| verify: | |
| name: verify before release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Build (release) | |
| run: cargo build --release | |
| - name: Run tests | |
| run: cargo test --release | |
| package: | |
| name: build & package | |
| needs: verify | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: Resolve version | |
| id: ver | |
| run: | | |
| REF="${{ github.event.inputs.tag || github.ref_name }}" | |
| VERSION="${REF#v}" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| echo "tag=$REF" >> "$GITHUB_OUTPUT" | |
| - name: Build release binary | |
| run: cargo build --release | |
| - name: Stage install tree | |
| run: | | |
| DIST="dist/librtmp2-server-${{ steps.ver.outputs.version }}" | |
| mkdir -p "$DIST" | |
| test -f target/release/librtmp2-server | |
| test -f .env.example | |
| cp target/release/librtmp2-server "$DIST/" | |
| cp .env.example "$DIST/.env" | |
| cp README.md LICENSE "$DIST/" | |
| - name: Create binary tarball | |
| run: | | |
| cd dist | |
| tar czf "librtmp2-server-${{ steps.ver.outputs.version }}-linux-x86_64.tar.gz" \ | |
| "librtmp2-server-${{ steps.ver.outputs.version }}" | |
| sha256sum "librtmp2-server-${{ steps.ver.outputs.version }}-linux-x86_64.tar.gz" \ | |
| > "librtmp2-server-${{ steps.ver.outputs.version }}-linux-x86_64.tar.gz.sha256" | |
| - name: Create source tarball | |
| run: | | |
| git archive --format=tar.gz \ | |
| --prefix="librtmp2-server-${{ steps.ver.outputs.version }}/" \ | |
| -o "dist/librtmp2-server-${{ steps.ver.outputs.version }}-src.tar.gz" HEAD | |
| cd dist | |
| sha256sum "librtmp2-server-${{ steps.ver.outputs.version }}-src.tar.gz" \ | |
| > "librtmp2-server-${{ steps.ver.outputs.version }}-src.tar.gz.sha256" | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: librtmp2-server-${{ steps.ver.outputs.version }} | |
| path: | | |
| dist/*.tar.gz | |
| dist/*.sha256 | |
| - name: Publish GitHub Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| tag_name: ${{ steps.ver.outputs.tag }} | |
| name: librtmp2-server ${{ steps.ver.outputs.version }} | |
| generate_release_notes: true | |
| files: | | |
| dist/*.tar.gz | |
| dist/*.sha256 |