This repository has been archived by the owner on Jul 21, 2024. It is now read-only.
update #88
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
name: Build && Release | |
on: | |
push: | |
permissions: write-all | |
concurrency: | |
group: ${{ github.workflow }}-${{ startsWith(github.event.head_commit.message, 'ver') && github.event.head_commit.message || 'dev' }} | |
cancel-in-progress: true | |
jobs: | |
Build: | |
name: Build - ${{ matrix.release_for }} | |
strategy: | |
matrix: | |
include: | |
# linux | |
- release_for: Linux-ARM | |
os: ubuntu-20.04 | |
target: aarch64-unknown-linux-gnu | |
bin: songbird_node | |
name: aarch64-unknown-linux-gnu.zip | |
command: both | |
- release_for: Linux-i686 | |
os: ubuntu-20.04 | |
target: i686-unknown-linux-gnu | |
bin: songbird_node | |
name: i686-unknown-linux-gnu.zip | |
command: both | |
- release_for: Linux-x86_64 | |
os: ubuntu-20.04 | |
target: x86_64-unknown-linux-gnu | |
bin: songbird_node | |
name: x86_64-unknown-linux-gnu.zip | |
command: both | |
# win | |
- release_for: Windows-x86_64 | |
os: windows-latest | |
target: x86_64-pc-windows-msvc | |
bin: songbird_node.exe | |
name: x86_64-pc-windows-msvc.zip | |
command: both | |
- release_for: Windows-i686 | |
os: windows-latest | |
target: i686-pc-windows-msvc | |
bin: songbird_node.exe | |
name: i686-pc-windows-msvc.zip | |
command: both | |
# mac | |
- release_for: macOS-x86_64 | |
os: macOS-latest | |
target: x86_64-apple-darwin | |
bin: songbird_node | |
name: x86_64-apple-darwin.zip | |
command: both | |
- release_for: macOS-ARM | |
os: macOS-latest | |
target: aarch64-apple-darwin | |
bin: songbird_node | |
name: aarch64-apple-darwin.zip | |
command: both | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Shout Commit ID | |
id: vars | |
shell: bash | |
run: echo "sha_short=dev-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
- name: Install Rust | |
# Or @nightly if you want | |
uses: dtolnay/rust-toolchain@stable | |
# Arguments to pass in | |
with: | |
# Make Rust compile to our target (defined in the matrix) | |
targets: ${{ matrix.target }} | |
- name: Build | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: true | |
command: build | |
args: --verbose --release --target ${{ matrix.target }} | |
- name: Build archive | |
shell: bash | |
run: | | |
# Replace with the name of your binary | |
binary_name="songbird_node" | |
mkdir zip_cp | |
mkdir artifact | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
mv "target/${{ matrix.target }}/release/$binary_name.exe" zip_cp | |
else | |
mv "target/${{ matrix.target }}/release/$binary_name" zip_cp | |
fi | |
mv "config.json" zip_cp | |
7z a "artifact/${{ matrix.release_for }}.zip" "./zip_cp/*" | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Build | |
path: artifact/* | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
- name: Delete Old Release | |
if: ${{ startsWith(steps.previoustag.outputs.tag, 'dev-') }} | |
continue-on-error: true | |
uses: dev-drprasad/[email protected] | |
with: | |
tag_name: ${{ steps.previoustag.outputs.tag }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
delete_release: true | |
- name: Upload to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: artifact/* | |
asset_name: ${{ matrix.asset_name }} | |
tag: ${{ startsWith(github.event.head_commit.message, 'ver') && github.event.head_commit.message || steps.vars.outputs.sha_short }} | |
file_glob: true | |
prerelease: ${{ !startsWith(github.event.head_commit.message, 'ver') }} |