From 012201315d693955de5f5db19224142dd6fe93ff Mon Sep 17 00:00:00 2001 From: Ivan Valdes Date: Tue, 21 May 2024 21:44:17 -0700 Subject: [PATCH] github: add release action --- .github/workflows/release.yaml | 70 ++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..41bc045 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,70 @@ +# Based on https://github.com/open-contracting/cardinal-rs/blob/792a6df7d78f8800a0f86cbf081cbad4781faf43/.github/workflows/release.yml +name: Release +on: + push: + tags: + - v* +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - env: + GH_TOKEN: ${{ github.token }} + run: gh release create ${{ github.ref_name }} + assets: + needs: release + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + # 32-bit (i686) + - build: linux-i686 + os: ubuntu-latest + target: i686-unknown-linux-gnu + command: cross + - build: windows-i686 + os: ubuntu-latest + target: i686-pc-windows-gnu + command: cross + # 64-bit (x86) + - build: linux-x86_64 + os: ubuntu-latest + target: x86_64-unknown-linux-gnu + command: cross + - build: macos-x86_64 + os: macos-latest + target: x86_64-apple-darwin + command: cargo + - build: windows-x86_64 + os: ubuntu-latest + target: x86_64-pc-windows-gnu + command: cross + # 64-bit (ARM) + - build: macos-arm64 + os: macos-latest + target: aarch64-apple-darwin + command: cargo + - build: linux-arm64 + os: ubuntu-latest + target: aarch64-unknown-linux-gnu + command: cross + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@nightly + with: + targets: ${{ matrix.target }} + - run: cargo install cross --git https://github.com/cross-rs/cross + - run: ${{ matrix.command }} build --release --target ${{ matrix.target }} + - id: rename + shell: bash + run: | + if [[ "${{ matrix.target }}" =~ "-pc-windows-" ]]; then + SUFFIX=.exe + fi + OUTPUT="marker-${{ matrix.build }}$SUFFIX" + mv "target/${{ matrix.target }}/release/marker$SUFFIX" "$OUTPUT" + echo "path=$OUTPUT" >> $GITHUB_OUTPUT + - env: + GH_TOKEN: ${{ github.token }} + run: gh release upload ${{ github.ref_name }} ${{ steps.rename.outputs.path }}