From 6c6b5c3c9b67681de1566dcc7f2f71ea3be72864 Mon Sep 17 00:00:00 2001 From: Johannes Naylor Date: Mon, 26 Aug 2024 13:53:00 +0200 Subject: [PATCH] fix release --- .github/workflows/release.yml | 69 ++++++++++++++++++++++++++++------- 1 file changed, 56 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 08392b0..bcbdb1a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,27 +1,70 @@ +name: Release + on: push: tags: - "v[0-9]+.*" + jobs: - release: - name: Release ${{ matrix.target }} + create-release: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Create Release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + draft: false + prerelease: false + + build-and-upload: + needs: create-release + name: Build and upload for ${{ matrix.os }} + runs-on: ${{ matrix.os }} strategy: matrix: include: - - target: x86_64-pc-windows-gnu - archive: zip - - target: x86_64-unknown-linux-musl - archive: tar.gz - - target: x86_64-apple-darwin - archive: zip + - os: ubuntu-latest + artifact_name: sherlock + asset_name: sherlock-linux + - os: windows-latest + artifact_name: sherlock-windows.exe + asset_name: sherlock-windows.exe + - os: macos-latest + artifact_name: sherlock-macos + asset_name: sherlock-macos + steps: - uses: actions/checkout@v3 - - name: Build and upload - uses: rust-build/rust-build.action@v1.4.5 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + + - name: Build + run: cargo build --release + + - name: Rename binary + run: | + if [ "${{ matrix.os }}" = "windows-latest" ]; then + mv target/release/sherlock.exe ${{ matrix.artifact_name }} + else + mv target/release/sherlock ${{ matrix.artifact_name }} + fi + shell: bash + + - name: Upload Release Asset + uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - MACOSX_DEPLOYMENT_TARGET: "11.3" with: - RUSTTARGET: ${{ matrix.target }} - ARCHIVE_TYPES: ${{ matrix.archive }} + upload_url: ${{ needs.create-release.outputs.upload_url }} + asset_path: ./${{ matrix.artifact_name }} + asset_name: ${{ matrix.asset_name }} + asset_content_type: application/octet-stream