Skip to content

Commit

Permalink
[chore]: init publish
Browse files Browse the repository at this point in the history
Signed-off-by: Manas Pratim Biswas <[email protected]>
  • Loading branch information
sanam2405 committed Dec 9, 2024
1 parent 5b548e0 commit 2d53d26
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 16 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: "publish"

on:
push:
branches:
- release

# This is the example from the readme.
# On each push to the `release` branch it will create or update a GitHub release, build your app, and upload the artifacts to the release.

jobs:
publish-tauri:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: "macos-latest" # for Arm based macs (M1 and above).
args: "--target aarch64-apple-darwin"
- platform: "macos-latest" # for Intel based macs.
args: "--target x86_64-apple-darwin"
- platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04.
args: ""
- platform: "windows-latest"
args: ""

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
# This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
# webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2.
# You can remove the one that doesn't apply to your app to speed up the workflow a bit.

- uses: actions/checkout@v3

- name: Setup pnpm
uses: pnpm/action-setup@v3 # docs https://pnpm.io/continuous-integration#github-actions
with:
version: 9.12.1 # Optional: specify a pnpm version

- name: install frontend dependencies
run: pnpm install

- name: Build the app
run: pnpm build

- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
projectPath: apps/desktop
includeDebug: true
tagName: app-v__VERSION__ # the action automatically replaces \_\_VERSION\_\_ with the app version.
releaseName: "App v__VERSION__"
releaseBody: "See the assets to download this version and install."
releaseDraft: true
prerelease: false
args: ${{ matrix.args }}
4 changes: 2 additions & 2 deletions apps/desktop/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import { Roman, RomanDescription, RomanTitle } from "./Roman";
import { RPEditor } from "./RPEditor";
import { RPMenuBar } from "./RPMenuBar";
import { RPMenuItems } from "./RPMenuItems";
import { RPSidebar } from "./RPSidebar";
import { RPTerminal } from "./RPTerm";
import { Scribble } from "./Scribble";
import { Sorry } from "./Sorry";
import { Spots } from "./Spots";
import { RPSidebar } from "./RPSidebar";
export {
Aura,
backgroundOverlay,
Expand All @@ -33,10 +33,10 @@ export {
RPEditor,
RPMenuBar,
RPMenuItems,
RPSidebar,
RPTerminal,
Scribble,
Sorry,
Spots,
World,
RPSidebar,
};
24 changes: 13 additions & 11 deletions apps/desktop/src/hooks/use-mobile.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import * as React from "react"
import * as React from "react";

const MOBILE_BREAKPOINT = 768
const MOBILE_BREAKPOINT = 768;

export function useIsMobile() {
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(
undefined,
);

React.useEffect(() => {
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
const onChange = () => {
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
}
mql.addEventListener("change", onChange)
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
return () => mql.removeEventListener("change", onChange)
}, [])
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
};
mql.addEventListener("change", onChange);
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
return () => mql.removeEventListener("change", onChange);
}, []);

return !!isMobile
return !!isMobile;
}
6 changes: 3 additions & 3 deletions apps/desktop/src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { clsx, type ClassValue } from "clsx"
import { twMerge } from "tailwind-merge"
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
return twMerge(clsx(inputs));
}

0 comments on commit 2d53d26

Please sign in to comment.