fix(actions): make actions less repetitive #274
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 | |
on: | |
push: | |
paths: | |
- '.github/workflows/build.yml' | |
- 'src-tauri/**/*' | |
- 'src/**/*' | |
pull_request: | |
paths: | |
- '.github/workflows/build.yml' | |
- 'src-tauri/**/*' | |
- 'src/**/*' | |
concurrency: | |
group: ${{ github.ref }}-${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: ${{ matrix.platform }} | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: [windows-latest, ubuntu-latest, macos-latest] | |
steps: | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8.6.7 | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Install Linux dependencies | |
if: matrix.platform == '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 | |
# Make empty folders for plugins and themes | |
- name: Create empty folders for plugins and themes | |
run: mkdir src-tauri/target/release/plugins && mkdir src-tauri/target/release/themes | |
- name: Create empty config.json | |
run: cd src-tauri/target/release && touch config.json | |
- name: Install deps and build | |
run: pnpm install && pnpm vupdate && pnpm prebuild && pnpm build && pnpm tauri build | |
# paths: | |
# Windows: | |
# - src-tauri/target/release/Dorion.exe|config.json|plugins|themes|injection|html|icons | |
# Ubuntu: | |
# - src-tauri/target/release/dorion|config.json|plugins|themes|injection|html|icons | |
# MacOS: | |
# - src-tauri/target/universal-apple-darwin/release/bundle/macos/Dorion.app | |
- name: Compress build | |
if: matrix.platform == 'windows-latest' | |
run: 7z a -tzip Dorion.zip src-tauri/target/release/Dorion.exe src-tauri/target/release/config.json src-tauri/target/release/plugins/ src-tauri/target/release/themes/ src-tauri/target/release/injection src-tauri/target/release/html/ src-tauri/target/release/icons/ | |
- name: Compress build | |
if: matrix.platform == 'ubuntu-latest' | |
run: cd src-tauri/target/release && tar -czvf dorion.tar.gz dorion config.json ./plugins ./themes ./injection ./html ./icons | |
- name: Upload build | |
if: matrix.platform == 'windows-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Dorion_win64_portable.zip | |
path: Dorion.zip | |
- name: Upload build | |
if: matrix.platform == 'ubuntu-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Dorion_amd64_portable.tar.gz | |
path: dorion.tar.gz | |
- name: Upload .app | |
if: matrix.platform == 'macos-latest' | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Dorion.app | |
path: src-tauri/target/universal-apple-darwin/release/bundle/macos/Dorion.app |