# Copied from https://github.com/sagebind/naru/blob/8d29e81a0074b97aff703f42ffa8b5f44f543d05/.github/workflows/release-binaries.yml
name: release-binaries
on:
release:
types: [published]
jobs:
linux-x86_64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
- name: Build binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release --target x86_64-unknown-linux-musl
use-cross: true
- name: Optimize and package binary
run: |
cd target/x86_64-unknown-linux-musl/release
strip histdb-rs
chmod +x histdb-rs
tar -c histdb-rs | gzip > histdb-rs.tar.gz
- name: Upload binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_name: histdb-rs-${{ github.event.release.tag-name }}-linux-x86_64.tar.gz
asset_path: target/x86_64-unknown-linux-musl/release/histdb-rs.tar.gz
upload_url: ${{ github.event.release.upload_url }}
macos-x86_64:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
- name: Build binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release
use-cross: true
- name: Optimize and package binary
run: |
cd target/release
strip histdb-rs
chmod +x histdb-rs
mkdir dmg
mv histdb-rs dmg/
hdiutil create -fs HFS+ -srcfolder dmg -volname histdb-rs histdb-rs.dmg
- name: Upload binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_name: histdb-rs-${{ github.event.release.tag-name }}-macos-x86_64.dmg
asset_path: target/release/histdb-rs.dmg
upload_url: ${{ github.event.release.upload_url }}
windows-x86_64:
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
default: true
- name: Build binary
uses: actions-rs/cargo@v1
with:
command: build
args: --release
use-cross: true
- name: Upload binary
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_name: histdb-rs-${{ github.event.release.tag-name }}-windows-x86_64.exe
asset_path: target/release/histdb-rs.exe
upload_url: ${{ github.event.release.upload_url }}