-
Notifications
You must be signed in to change notification settings - Fork 14
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
1 parent
1889ba2
commit 1c556e9
Showing
1 changed file
with
94 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,94 @@ | ||
name: Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' # Run this workflow only when a tag is pushed | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
target: [x86_64-unknown-linux-gnu, x86_64-pc-windows-gnu, x86_64-apple-darwin] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
target: ${{ matrix.target }} | ||
default: true | ||
|
||
- name: Install dependencies | ||
if: matrix.target == 'x86_64-pc-windows-gnu' | ||
run: sudo apt-get install -y mingw-w64 | ||
|
||
- name: Build | ||
run: cargo build --release --target ${{ matrix.target }} | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ matrix.target }}-binary | ||
path: target/${{ matrix.target }}/release/fyin | ||
|
||
release: | ||
runs-on: ubuntu-latest | ||
needs: build | ||
|
||
steps: | ||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ matrix.target }}-binary | ||
path: binaries/${{ matrix.target }} | ||
|
||
- 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 Linux | ||
if: matrix.target == 'x86_64-unknown-linux-gnu' | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: binaries/x86_64-unknown-linux-gnu/fyin | ||
asset_name: fyin-linux | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Release Asset Windows | ||
if: matrix.target == 'x86_64-pc-windows-gnu' | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: binaries/x86_64-pc-windows-gnu/fyin.exe | ||
asset_name: fyin-windows.exe | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Release Asset macOS | ||
if: matrix.target == 'x86_64-apple-darwin' | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: binaries/x86_64-apple-darwin/fyin | ||
asset_name: fyin-macos | ||
asset_content_type: application/octet-stream | ||
|