feat: enhance Cargo.toml files with repository, description, keywords… #8
Workflow file for this run
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
| # .github/workflows/release-core.yml | |
| # | |
| # Builds scp2p-cli binaries for all platforms and publishes the Rust crates | |
| # to crates.io whenever a core version tag is pushed. | |
| # | |
| # Trigger: push a tag matching v<semver> (e.g. v0.1.0) | |
| # | |
| # CLI binaries produced: | |
| # scp2p-linux-x86_64 | |
| # scp2p-linux-aarch64 | |
| # scp2p-macos-x86_64 | |
| # scp2p-macos-aarch64 | |
| # scp2p-windows-x86_64.exe | |
| # | |
| # crates.io packages published (in dependency order): | |
| # 1. scp2p-core | |
| # 2. scp2p-cli (depends on scp2p-core) | |
| # 3. scp2p-relay (depends on scp2p-core) | |
| # | |
| # Required secret: | |
| # CARGO_REGISTRY_TOKEN — crates.io API token with publish scope | |
| # | |
| # The publish job is skipped automatically when the secret is not set. | |
| name: Release Core | |
| on: | |
| push: | |
| tags: | |
| - "v[0-9]+.[0-9]+.[0-9]+" | |
| permissions: | |
| contents: write | |
| # ── 1. Build scp2p-cli binaries ─────────────────────────────────────────────── | |
| jobs: | |
| build-cli: | |
| name: Build CLI ${{ matrix.target }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - target: x86_64-unknown-linux-gnu | |
| os: ubuntu-22.04 | |
| asset_name: scp2p-linux-x86_64 | |
| - target: aarch64-unknown-linux-gnu | |
| os: ubuntu-22.04 | |
| asset_name: scp2p-linux-aarch64 | |
| cross: true | |
| - target: x86_64-apple-darwin | |
| os: macos-14 | |
| asset_name: scp2p-macos-x86_64 | |
| - target: aarch64-apple-darwin | |
| os: macos-14 | |
| asset_name: scp2p-macos-aarch64 | |
| - target: x86_64-pc-windows-msvc | |
| os: windows-2022 | |
| asset_name: scp2p-windows-x86_64.exe | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.target }} | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: cli-${{ matrix.target }} | |
| - name: Install cross (aarch64-linux) | |
| if: matrix.cross == true | |
| run: cargo install cross --locked | |
| - name: Build (native) | |
| if: matrix.cross != true | |
| run: cargo build --release --package scp2p-cli --target ${{ matrix.target }} | |
| - name: Build (cross) | |
| if: matrix.cross == true | |
| run: cross build --release --package scp2p-cli --target ${{ matrix.target }} | |
| - name: Rename binary (Unix) | |
| if: runner.os != 'Windows' | |
| run: | | |
| cp target/${{ matrix.target }}/release/scp2p-cli ${{ matrix.asset_name }} | |
| chmod +x ${{ matrix.asset_name }} | |
| - name: Rename binary (Windows) | |
| if: runner.os == 'Windows' | |
| shell: pwsh | |
| run: Copy-Item "target\${{ matrix.target }}\release\scp2p-cli.exe" "${{ matrix.asset_name }}" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.asset_name }} | |
| path: ${{ matrix.asset_name }} | |
| if-no-files-found: error | |
| # ── 2. Create GitHub Release with all CLI binaries ──────────────────────── | |
| release: | |
| name: Publish GitHub Release | |
| needs: build-cli | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout (for install scripts) | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| - name: List assets | |
| run: ls -lh scp2p-* scp2p-relay-* 2>/dev/null || ls -lh | |
| - name: Derive version | |
| id: version | |
| run: echo "ver=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Create release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: "scp2p v${{ steps.version.outputs.ver }}" | |
| tag_name: ${{ github.ref_name }} | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-') }} | |
| body: | | |
| ## scp2p v${{ steps.version.outputs.ver }} | |
| Core protocol library and CLI tool. | |
| ### scp2p-cli — one-line install | |
| **Linux / macOS** | |
| ```sh | |
| curl -sSfL https://raw.githubusercontent.com/${{ github.repository }}/main/install.sh | sh -s -- --tool cli | |
| ``` | |
| **Windows (PowerShell)** | |
| ```powershell | |
| irm https://raw.githubusercontent.com/${{ github.repository }}/main/install.ps1 | iex | |
| ``` | |
| **Via cargo** | |
| ```sh | |
| cargo install scp2p-cli | |
| ``` | |
| ### CLI binaries | |
| | File | Platform | | |
| |---|---| | |
| | `scp2p-linux-x86_64` | Linux x86-64 | | |
| | `scp2p-linux-aarch64` | Linux arm64 (Raspberry Pi, Graviton) | | |
| | `scp2p-macos-x86_64` | macOS Intel | | |
| | `scp2p-macos-aarch64` | macOS Apple Silicon | | |
| | `scp2p-windows-x86_64.exe` | Windows 10/11 | | |
| ### Crates | |
| - [`scp2p-core`](https://crates.io/crates/scp2p-core) — protocol library | |
| - [`scp2p-cli`](https://crates.io/crates/scp2p-cli) — CLI tool | |
| - [`scp2p-relay`](https://crates.io/crates/scp2p-relay) — standalone relay node | |
| files: | | |
| scp2p-linux-x86_64 | |
| scp2p-linux-aarch64 | |
| scp2p-macos-x86_64 | |
| scp2p-macos-aarch64 | |
| scp2p-windows-x86_64.exe | |
| # ── 3. Publish crates to crates.io ─────────────────────────────────────── | |
| # Runs only when CARGO_REGISTRY_TOKEN is set in repository secrets. | |
| publish-crates: | |
| name: Publish crates.io | |
| needs: build-cli # wait for a successful build before publishing | |
| runs-on: ubuntu-22.04 | |
| # Skip entirely if the secret is absent (e.g. forks, first-time setup). | |
| # Checked at step level because `secrets` context is not available in | |
| # job-level `if` expressions. | |
| env: | |
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache Cargo | |
| uses: Swatinem/rust-cache@v2 | |
| # Publish in strict dependency order. | |
| # `--no-verify` skips a redundant local build; the binary build job | |
| # above has already verified correctness. | |
| # Each step sleeps 20 s after publishing so crates.io has time to index | |
| # the new version before the next crate tries to resolve it. | |
| - name: Publish scp2p-core | |
| if: ${{ env.CARGO_REGISTRY_TOKEN != '' }} | |
| run: | | |
| cargo publish --package scp2p-core --no-verify | |
| sleep 20 | |
| - name: Publish scp2p-cli | |
| if: ${{ env.CARGO_REGISTRY_TOKEN != '' }} | |
| run: | | |
| cargo publish --package scp2p-cli --no-verify | |
| sleep 20 | |
| - name: Publish scp2p-relay | |
| if: ${{ env.CARGO_REGISTRY_TOKEN != '' }} | |
| run: cargo publish --package scp2p-relay --no-verify |