-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- "v*.*.*" # Matches version tags like v1.0.0 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: | ||
- x86_64-unknown-linux-gnu | ||
- aarch64-unknown-linux-gnu | ||
- x86_64-pc-windows-msvc | ||
- aarch64-pc-windows-msvc | ||
- x86_64-apple-darwin | ||
- aarch64-apple-darwin | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
override: true | ||
|
||
- name: Install target | ||
run: rustup target add ${{ matrix.target }} | ||
|
||
- name: Build for Linux and Windows | ||
if: matrix.target != 'x86_64-apple-darwin' && matrix.target != 'aarch64-apple-darwin' | ||
run: cargo build --release --target ${{ matrix.target }} | ||
|
||
- name: Build for macOS | ||
if: matrix.target == 'x86_64-apple-darwin' || matrix.target == 'aarch64-apple-darwin' | ||
uses: docker://ghcr.io/crazy-max/osxcross:latest | ||
with: | ||
entrypoint: /bin/sh | ||
args: -c "cargo build --release --target ${{ matrix.target }}" | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.target }}-release | ||
path: target/${{ matrix.target }}/release/ | ||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ matrix.target }}-release | ||
path: ./artifacts | ||
|
||
- 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 | ||
|
||
- name: Upload Release Asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./artifacts | ||
asset_name: ${{ matrix.target }}-release | ||
asset_content_type: application/zip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[target.x86_64-apple-darwin] | ||
image = "ghcr.io/cross-rs/x86_64-apple-darwin:latest" | ||
|
||
[target.aarch64-apple-darwin] | ||
image = "ghcr.io/cross-rs/aarch64-apple-darwin:latest" |