workflows #8
Workflow file for this run
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 and Release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-11, ubuntu-latest, windows-latest] | |
include: | |
- os: macos-11 | |
rust_target: "x86_64-apple-darwin" | |
arch: "universal" # for macOS universal (Intel + Silicon) | |
- os: ubuntu-latest | |
rust_target: "x86_64-unknown-linux-gnu" | |
arch: "x86_64" | |
- os: windows-latest | |
rust_target: "x86_64-pc-windows-msvc" | |
arch: "x86_64" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '16' | |
- name: Cache Yarn | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/yarn | |
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn- | |
- name: Install dependencies | |
run: yarn install | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
target: ${{ matrix.rust_target }} | |
default: true | |
- name: Install Tauri CLI | |
run: yarn global add @tauri-apps/cli | |
- name: Install system dependencies (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
libwebkit2gtk-4.0-dev \ | |
build-essential \ | |
curl \ | |
wget \ | |
libssl-dev \ | |
libgtk-3-dev \ | |
libayatana-appindicator3-dev \ | |
librsvg2-dev \ | |
pkg-config \ | |
gnome-icon-theme | |
- name: Build Tauri App | |
run: yarn tauri build | |
- name: Zip artifacts (macOS and Linux) | |
if: matrix.os != 'windows-latest' | |
run: zip -r artifacts-${{ matrix.os }}.zip src-tauri/target/release/bundle/** | |
- name: Zip artifacts (Windows) | |
if: matrix.os == 'windows-latest' | |
run: Compress-Archive -Path src-tauri/target/release/bundle/* -DestinationPath artifacts-${{ matrix.os }}.zip | |
- name: Upload artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.os }}-artifact | |
path: ./artifacts-${{ matrix.os }}.zip | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download artifacts from macOS | |
uses: actions/download-artifact@v2 | |
with: | |
name: macos-11-artifact | |
path: ./artifacts-macos-11.zip | |
- name: Download artifacts from Ubuntu | |
uses: actions/download-artifact@v2 | |
with: | |
name: ubuntu-latest-artifact | |
path: ./artifacts-ubuntu-latest.zip | |
- name: Download artifacts from Windows | |
uses: actions/download-artifact@v2 | |
with: | |
name: windows-latest-artifact | |
path: ./artifacts-windows-latest.zip | |
- 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 macOS Release Asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts-macos-11.zip | |
asset_name: macos-${{ github.run_number }}.zip | |
asset_content_type: application/zip | |
- name: Upload Ubuntu Release Asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts-ubuntu-latest.zip | |
asset_name: ubuntu-${{ github.run_number }}.zip | |
asset_content_type: application/zip | |
- name: Upload Windows Release Asset | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./artifacts-windows-latest.zip | |
asset_name: windows-${{ github.run_number }}.zip | |
asset_content_type: application/zip |