diff --git a/.github/workflows/release-binaries.yml b/.github/workflows/release-binaries.yml new file mode 100644 index 00000000..c1d16c7e --- /dev/null +++ b/.github/workflows/release-binaries.yml @@ -0,0 +1,55 @@ +name: Release binaries + +on: + release: + types: [created] + +permissions: + contents: read + +jobs: + upload-cot-cli: + if: startsWith(github.event.release.tag_name, 'cot-cli-v') + name: Upload cot-cli (${{ matrix.target }}) + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-unknown-linux-gnu + os: ubuntu-latest + - target: aarch64-unknown-linux-gnu + os: ubuntu-latest + - target: x86_64-apple-darwin + os: macos-latest + - target: aarch64-apple-darwin + os: macos-latest + - target: x86_64-pc-windows-msvc + os: windows-latest + - target: aarch64-pc-windows-msvc + os: windows-latest + runs-on: ${{ matrix.os }} + permissions: + contents: write + steps: + - name: Checkout source + uses: actions/checkout@v7 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Install cross + if: matrix.target == 'aarch64-unknown-linux-gnu' + uses: taiki-e/install-action@v2.85.4 + with: + tool: cross + + - name: Build and upload cot-cli + uses: taiki-e/upload-rust-binary-action@v1.30.2 + with: + bin: cot + package: cot-cli + target: ${{ matrix.target }} + archive: cot-cli-$target + include: LICENSE-APACHE,LICENSE-MIT + checksum: sha256 + locked: true diff --git a/cot-cli/Cargo.toml b/cot-cli/Cargo.toml index 341b564b..6fd82f04 100644 --- a/cot-cli/Cargo.toml +++ b/cot-cli/Cargo.toml @@ -16,6 +16,10 @@ authors.workspace = true name = "cot" path = "src/main.rs" +[package.metadata.binstall] +pkg-url = "{ repo }/releases/download/{ name }-v{ version }/{ name }-{ target }{ archive-suffix }" +bin-dir = "{ bin }{ binary-ext }" + [lints] workspace = true