-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GH action to build and release xsynth-render (#97)
- Loading branch information
1 parent
dbe2a6b
commit acfe2d8
Showing
2 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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,145 @@ | ||
name: Deploy | ||
|
||
on: | ||
push: | ||
tags: | ||
- "*" | ||
|
||
jobs: | ||
build-linux: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
target: | ||
- name: x86_64-unknown-linux-gnu | ||
arch: x64 | ||
- name: aarch64-unknown-linux-gnu | ||
arch: arm64 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
target: ${{ matrix.target.name }} | ||
override: true | ||
profile: minimal | ||
|
||
- uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: true | ||
command: build | ||
args: --release --target=${{ matrix.target.name }} | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "xsynth-render-linux-${{ matrix.target.arch }}" | ||
path: "target/${{ matrix.target.name }}/release/xsynth-render" | ||
|
||
build-macos: | ||
runs-on: macos-latest | ||
strategy: | ||
matrix: | ||
target: | ||
- name: x86_64-apple-darwin | ||
arch: x86 | ||
- name: aarch64-apple-darwin | ||
arch: arm64 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install target | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
target: ${{ matrix.target.name }} | ||
override: true | ||
profile: minimal | ||
|
||
- name: Build binary | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --target ${{ matrix.target.name }} | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "xsynth-render-macos-${{ matrix.target.arch }}" | ||
path: "target/${{ matrix.target.name }}/release/xsynth-render" | ||
|
||
build-windows: | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
target: | ||
- name: x86_64-pc-windows-msvc | ||
arch: x64 | ||
- name: aarch64-pc-windows-msvc | ||
arch: arm64 | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup ninja | ||
uses: seanmiddleditch/gha-setup-ninja@master | ||
|
||
- name: Install Rust toolchain | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: nightly | ||
target: ${{ matrix.target.name }} | ||
override: true | ||
profile: minimal | ||
|
||
- name: Build binary | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: build | ||
args: --release --target ${{ matrix.target.name }} | ||
|
||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: "xsynth-render-windows-${{ matrix.target.arch }}" | ||
path: "target/${{ matrix.target.name }}/release/xsynth-render.exe" | ||
|
||
create-release: | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/') | ||
needs: | ||
- build-linux | ||
- build-macos | ||
- build-windows | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
with: | ||
path: ./artifacts | ||
|
||
- name: Move files | ||
run: | | ||
mkdir out | ||
for dir in ./artifacts/*; do | ||
for file in $dir/*; do | ||
cp $dir/* ./out/${dir##*/}.${file##*.} | ||
done | ||
done | ||
- name: Create draft release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
body: A new draft release. | ||
draft: true | ||
files: ./out/* |