Skip to content

Commit

Permalink
Workflow to create release assets for different platforms (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
robiot authored Aug 15, 2022
1 parent bb1bd9b commit 0a79336
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
on:
push:
tags:
- "v*"

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_TERM_COLOR: always

name: Create Release / Upload Assets

jobs:
windows:
name: Build for Windows
runs-on: windows-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Test
run: cargo test --release

- name: Build
run: cargo build --release

- name: "Move to outputs/ folder"
run: |
mkdir outputs
cp target/release/*.exe outputs/rcat-${{github.ref_name}}-win.exe
- name: Upload to temporary storage
uses: actions/upload-artifact@master
with:
name: output-artifact
path: outputs

linux:
name: Build for Linux
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Test
run: cargo test --release

- name: Build
run: cargo build --release

- name: Install cargo-deb
run: cargo install cargo-deb

- name: Create deb package
run: cargo deb

# Name of binary needed
- name: "Move to outputs/ folder"
run: |
mkdir outputs
cp target/release/rcat outputs/rcat-${{github.ref_name}}-linux-x86_64
cp target/debian/*.deb outputs/rcat-${{github.ref_name}}-linux-x86_64.deb
- name: Upload to temporary storage
uses: actions/upload-artifact@master
with:
name: output-artifact
path: outputs

macos:
name: Build for Mac
runs-on: macos-11

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install ARM target
run: rustup update && rustup target add aarch64-apple-darwin

- name: Test
run: cargo test --release

- name: Build
run: cargo build --release --target=aarch64-apple-darwin

- name: Build
run: cargo build --release

# Name of binary needed
- name: "Move to outputs/ folder"
run: |
mkdir outputs
cp target/aarch64-apple-darwin/release/rcat outputs/rcat-${{github.ref_name}}-darwin-aarch64
cp target/release/rcat outputs/rcat-${{github.ref_name}}-darwin-x86_64
- name: Upload to temporary storage
uses: actions/upload-artifact@master
with:
name: output-artifact
path: outputs

release:
name: Create/or release assets
runs-on: ubuntu-latest
needs: [windows, linux, macos]

steps:
- name: Download from temporary storage
uses: actions/download-artifact@master
with:
name: output-artifact
path: outputs

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v0.1.14
with:
generate_release_notes: true
# append_body: false
# draft: false
# prerelease: false
files: |
outputs/**

0 comments on commit 0a79336

Please sign in to comment.