Skip to content

Commit

Permalink
fix release
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaylor89 committed Aug 26, 2024
1 parent 54b42ed commit 6c6b5c3
Showing 1 changed file with 56 additions and 13 deletions.
69 changes: 56 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 6c6b5c3

Please sign in to comment.