name: Release
on:
push:
tags:
- "v*"
jobs:
aarch64-apple-darwin:
name: Build macOS ARM
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-apple-darwin
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --target aarch64-apple-darwin
- uses: actions/upload-artifact@v3
with:
name: aarch64-apple-darwin
path: target/aarch64-apple-darwin/release/postgresfixture
if-no-files-found: error
x86_64-apple-darwin:
name: Build macOS Intel
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-apple-darwin
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --target x86_64-apple-darwin
- uses: actions/upload-artifact@v3
with:
name: x86_64-apple-darwin
path: target/x86_64-apple-darwin/release/postgresfixture
if-no-files-found: error
macos-universal:
name: Build macOS Universal
runs-on: macos-latest
needs: [aarch64-apple-darwin, x86_64-apple-darwin]
steps:
- uses: actions/download-artifact@v3
with:
name: x86_64-apple-darwin
path: postgresfixture-x86_64-apple-darwin
- uses: actions/download-artifact@v3
with:
name: aarch64-apple-darwin
path: postgresfixture-aarch64-apple-darwin
- name: debug
run: find .
- name: Build Universal macOS Binary
run: |
lipo -create \
-output postgresfixture-apple-darwin \
postgresfixture-x86_64-apple-darwin/postgresfixture \
postgresfixture-aarch64-apple-darwin/postgresfixture
- uses: actions/upload-artifact@v3
with:
name: apple-darwin
path: postgresfixture-apple-darwin
if-no-files-found: error
build-linux:
name: Build Linux
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --target x86_64-unknown-linux-musl
- uses: actions/upload-artifact@v3
with:
name: linux
path: target/x86_64-unknown-linux-musl/release/postgresfixture
if-no-files-found: error
create-release:
name: Create release
needs: [macos-universal, build-linux]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: linux
path: linux
- uses: actions/download-artifact@v3
with:
name: apple-darwin
- name: Rename executables
run: |
mv -v linux/postgresfixture postgresfixture-linux
find .
- uses: softprops/action-gh-release@v1
with:
files: |
postgresfixture-apple-darwin
postgresfixture-linux
fail_on_unmatched_files: true