Skip to content

Commit

Permalink
update node-version in actions
Browse files Browse the repository at this point in the history
  • Loading branch information
OrangeDrangon committed Jan 2, 2024
1 parent 2029a9a commit 678df71
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 42 deletions.
54 changes: 33 additions & 21 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,47 @@ jobs:
- windows-latest
- ubuntu-latest
node-version:
- 17
- 20

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1

- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Cache node_modules
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
env:
cache-name: node-modules
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable

- run: sudo apt-get update -y && sudo apt-get install --no-install-recommends -y libopenjp2-tools rpm libarchive-tools
name: Install Linux Dependencies
if: (startsWith(matrix.os, 'ubuntu'))
- name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- run: yarn install --frozen-lockfile
- name: install pnpm
uses: pnpm/action-setup@v2
with:
version: latest
run_install: false

- run: yarn dist --publish onTagOrDraft
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Upload Build
uses: actions/[email protected]
- name: setup pnpm cache
uses: actions/cache@v3
with:
name: ${{ matrix.os }}-${{ matrix.node-version }}
path: ./dist
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: install node dependencies
run: pnpm install --frozen-lockfile

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52 changes: 33 additions & 19 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,47 @@ jobs:
- windows-latest
- ubuntu-latest
node-version:
- 17
- 20

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1

- name: setup node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Cache node_modules
uses: actions/cache@v2
with:
path: ./node_modules
key: ${{ matrix.os }}-${{ matrix.node-version }}-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
env:
cache-name: node-modules
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable

- run: sudo apt-get update -y && sudo apt-get install --no-install-recommends -y libopenjp2-tools rpm libarchive-tools
name: Install Linux Dependencies
if: (startsWith(matrix.os, 'ubuntu'))
- name: install dependencies (ubuntu only)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf
- run: yarn install --frozen-lockfile
- name: install pnpm
uses: pnpm/action-setup@v2
with:
version: latest
run_install: false

- run: yarn dist --publish never
- name: get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- name: Upload Build
uses: actions/[email protected]
- name: setup pnpm cache
uses: actions/cache@v3
with:
name: ${{ matrix.os }}-${{ matrix.node-version }}
path: ./dist
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: install node dependencies
run: pnpm install --frozen-lockfile

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16 changes: 14 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

use tauri::{
CustomMenuItem, Manager, Menu, MenuItem, Runtime, Submenu, SystemTray, SystemTrayEvent,
SystemTrayMenu, SystemTrayMenuItem,
SystemTrayMenu, SystemTrayMenuItem, WindowEvent,
};

const MAIN_WINDOW: &str = "main";

fn main() {
let tray_menu = SystemTrayMenu::new()
.add_item(CustomMenuItem::new("show", "Show Window"))
Expand All @@ -15,7 +17,7 @@ fn main() {
.system_tray(system_tray)
.on_system_tray_event(|app, event| match event {
SystemTrayEvent::DoubleClick { .. } => {
app.get_window("main").unwrap().show().unwrap();
app.get_window(MAIN_WINDOW).unwrap().show().unwrap();
}
SystemTrayEvent::MenuItemClick { tray_id, id, .. } => match id.as_str() {
"show" => {
Expand All @@ -30,6 +32,16 @@ fn main() {
_ => {}
})
.on_page_load(|window, payload| {})
.on_window_event(|event| match event.event() {
WindowEvent::CloseRequested { api, .. } => {
let window = event.window();
if window.label() == MAIN_WINDOW {
api.prevent_close();
event.window().hide().expect("Failed to hide window");
}
}
_ => {}
})
.build(tauri::generate_context!())
.expect("error while building tauri application")
.run(|_app, event| match event {
Expand Down

0 comments on commit 678df71

Please sign in to comment.