Skip to content

Commit

Permalink
workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFern2 committed Jun 13, 2024
1 parent 531251d commit 9e663b3
Show file tree
Hide file tree
Showing 3 changed files with 184 additions and 162 deletions.
104 changes: 104 additions & 0 deletions .github/workflows/build-and-cache.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Build and Cache

on:
push:
branches:
- main
- 'release/*'

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: Cache Build Artifacts (macOS and Linux)
if: matrix.os != 'windows-latest'
uses: actions/cache@v2
with:
path: src-tauri/target/release/bundle/
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-
- name: Cache Build Artifacts (Windows)
if: matrix.os == 'windows-latest'
uses: actions/cache@v2
with:
path: src-tauri/target/release/bundle/*
key: ${{ runner.os }}-build-${{ github.sha }}
restore-keys: |
${{ runner.os }}-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
162 changes: 0 additions & 162 deletions .github/workflows/build-and-release.yml

This file was deleted.

80 changes: 80 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Release

on:
workflow_dispatch:
inputs:
prerelease:
description: 'Mark this release as a pre-release'
required: true
default: false
type: boolean

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- 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: List downloaded files (macOS and Linux)
if: runner.os != 'Windows'
run: ls -la ./artifacts-*
shell: bash

- name: List downloaded files (Windows)
if: runner.os == 'Windows'
run: Get-ChildItem -Path ./artifacts-*
shell: pwsh

- 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: ${{ github.event.inputs.prerelease }}

- 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

0 comments on commit 9e663b3

Please sign in to comment.