From 1f1dda3df92a038cf3acbd6c62a69e19541bcaba Mon Sep 17 00:00:00 2001 From: usamoi Date: Mon, 9 Dec 2024 11:08:44 +0800 Subject: [PATCH] add support for cargo-binstall --- .github/workflows/upload-release.yml | 60 ++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/workflows/upload-release.yml diff --git a/.github/workflows/upload-release.yml b/.github/workflows/upload-release.yml new file mode 100644 index 000000000..4896f90fb --- /dev/null +++ b/.github/workflows/upload-release.yml @@ -0,0 +1,60 @@ +name: upload release + +on: + workflow_dispatch: + inputs: + tag: + type: string + description: Tag + required: true + +permissions: + contents: write + +jobs: + upload-release: + name: upload-release + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + pkg_fmt: .tar.gz + binary_ext: '' + - os: macos-13 + target: x86_64-apple-darwin + pkg_fmt: .tar.gz + binary_ext: '' + - os: macos-14 + target: aarch64-apple-darwin + pkg_fmt: .tar.gz + binary_ext: '' + - os: windows-2022 + target: x86_64-pc-windows-msvc + pkg_fmt: .zip + binary_ext: .exe + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.tag }} + - name: Upload cargo-pgrx + env: + GH_TOKEN: ${{ github.token }} + shell: bash + run: | + cargo build -p cargo-pgrx --bin cargo-pgrx --target ${{ matrix.target }} --release + + mkdir -p build + cp README.md ./build/ + cp LICENSE ./build/ + cp ./target/${{ matrix.target }}/release/cargo-pgrx${{ matrix.binary_ext }} ./build/ + + DIST=cargo-pgrx-${{ github.event.inputs.tag }}-${{ matrix.target }}${{ matrix.pkg_fmt }} + if [ "${{ matrix.os }}" = "windows-2022" ]; then + (cd build && 7z a ../$DIST .) + else + tar czf $DIST -C build . + fi + gh release upload ${{ github.event.inputs.tag }} $DIST