Merge branch 'main' into github-oauth

This commit is contained in:
neil 2023-01-06 11:23:57 +08:00
commit 41590f2e31
7 changed files with 92 additions and 224 deletions

View file

@ -66,25 +66,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: pnpm/action-setup@v2
with:
version: 7
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install app dependencies and build it
env:
BUILD_FOR: preview
run: pnpm install && pnpm --filter gui build
- name: build tauri for Linux
run: |
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf pkg-config
sh <(curl https://tea.xyz) build
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
@ -130,49 +115,44 @@ jobs:
- os: [self-hosted, macOS, ARM64]
name: darwin+aarch64
id: mac_m1
# err: Package atk was not found in the pkg-config search path.
# requires atk >= 2.18
# - os: [self-hosted, linux, ARM64]
# name: linux+aarch64
container: ${{ matrix.platform.container }}
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 7
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install app dependencies
run: pnpm install
- uses: actions/checkout@v3
- name: install dependencies (ubuntu only)
if: matrix.platform.name == 'linux+x86-64'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev
- name: build tauri for MacOS
uses: teaxyz/setup@v0
if: startsWith(matrix.platform.name, 'darwin')
# FROM: https://tauri.app/v1/guides/distribution/sign-macos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.GUI_APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
# TODO: uncomment once isolated m1 runner is setup with latest xcode
# only used for notarization
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
with:
target: build
- name: build tauri for Linux
# uses: teaxyz/setup@v0
if: startsWith(matrix.platform.name, 'linux')
# TODO: https://tauri.app/v1/guides/distribution/sign-linux
run: |
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf pkg-config
- uses: Swatinem/rust-cache@v2
with:
# The prefix cache key, this can be changed to start a new cache manually.
# default: "v0-rust"
prefix-key: ${{ matrix.platform.name }}
shared-key: ci
cache-targets: false
- name: Cache Tauri Target
uses: actions/cache@v3
with:
path: |
./modules/gui/src-tauri/target
key: ${{ matrix.platform.name }}-build-target
restore-keys: |
${{ matrix.platform.name }}-build-target
sh <(curl https://tea.xyz) build
- name: build platform output
id: build_platform
@ -187,24 +167,6 @@ jobs:
echo "build_platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT
echo "extension=$EXTENSION" >> $GITHUB_OUTPUT
- name: test build tauri for MacOS
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
# FROM: https://tauri.app/v1/guides/distribution/sign-macos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ENABLE_CODE_SIGNING: ${{ secrets.GUI_APPLE_CERTIFICATE }}
APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
run: pnpm build:gui
- name: test build tauri for Linux
if: matrix.platform.name == 'linux+x86-64'
# TODO: https://tauri.app/v1/guides/distribution/sign-linux
run: pnpm build:gui
- name: zip .app for MacOS
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
run: |
@ -234,7 +196,7 @@ jobs:
aws s3 cp ./modules/gui/src-tauri/target/release/bundle/macos/tea.zip "s3://preview.gui.tea.xyz/$prefix/tea_$platform.zip"
- name: comment install for Linux
if: matrix.platform.name == 'linux+x86-64'
if: startsWith(matrix.platform.name, 'linux')
uses: mshick/add-pr-comment@v2
with:
message-id: ${{ matrix.platform.id }}-comment
@ -248,7 +210,7 @@ jobs:
copy-paste into a browser to download
- name: comment install for MacOS
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
if: startsWith(matrix.platform.name, 'darwin')
uses: mshick/add-pr-comment@v2
with:
message-id: ${{ matrix.platform.id }}-comment

View file

@ -37,26 +37,12 @@ jobs:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: pnpm/action-setup@v2
with:
version: 7
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: install app dependencies and build it
run: pnpm install && pnpm --filter gui build
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: build tauri for Linux
if: startsWith(matrix.platform.name, 'linux')
run: |
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf pkg-config
sh <(curl https://tea.xyz) build
build_tauri:
needs: changes
if: needs.changes.outputs.tauri == 'true'
@ -74,47 +60,11 @@ jobs:
# name: linux+aarch64
container: ${{ matrix.platform.container }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 7
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
# The prefix cache key, this can be changed to start a new cache manually.
# default: "v0-rust"
prefix-key: ${{ matrix.platform.name }}
shared-key: prod
cache-targets: false
- name: install dependencies (ubuntu only)
if: matrix.platform.name == 'linux+x86-64'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: install app dependencies
run: pnpm install
- name: Cache Tauri Target
uses: actions/cache@v3
with:
path: |
./modules/gui/src-tauri/target
key: ${{ matrix.platform.name }}-build-target-prod
restore-keys: |
${{ matrix.platform.name }}-build-target-prod
- name: test build tauri for MacOS
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
- name: build tauri for MacOS
uses: teaxyz/setup@v0
if: startsWith(matrix.platform.name, 'darwin')
# FROM: https://tauri.app/v1/guides/distribution/sign-macos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -122,14 +72,20 @@ jobs:
APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
run: pnpm build:gui
# todo: uncomment when m1 with latest xcode is deployed
# this only helps in notarization
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
with:
target: build
- name: test build tauri for Linux
if: matrix.platform.name == 'linux+x86-64'
- name: build tauri for Linux
# uses: teaxyz/setup@v0
if: startsWith(matrix.platform.name, 'linux')
# TODO: https://tauri.app/v1/guides/distribution/sign-linux
run: pnpm build:gui
run: |
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf pkg-config
sh <(curl https://tea.xyz) build
- name: Get current unix ts - seconds
id: date
@ -154,7 +110,7 @@ jobs:
echo "extension=$EXTENSION" >> $GITHUB_OUTPUT
- name: zip .app for MacOS
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
if: startsWith(matrix.platform.name, 'darwin')
run: |
cd ./modules/gui/src-tauri/target/release/bundle/macos/ && zip -r tea.zip tea.app
@ -168,13 +124,15 @@ jobs:
"s3://preview.gui.tea.xyz/release/tea_${{ steps.date.outputs.unix_seconds }}_$platform.$extension"
- name: cp package zip for MacOS
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
if: startsWith(matrix.platform.name, 'darwin')
env:
platform: ${{ steps.build_platform.outputs.build_platform }}
build_platform: ${{ matrix.platform.name }}
run: |
aws s3 cp ./modules/gui/src-tauri/target/release/bundle/macos/tea.zip "s3://preview.gui.tea.xyz/release/tea_${{ steps.date.outputs.unix_seconds }}_$platform.zip"
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Slack Notification
run: ./.github/notify-slack.js
env:
@ -185,7 +143,7 @@ jobs:
- name: Slack Notification for .app Mac
run: ./.github/notify-slack.js
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
if: startsWith(matrix.platform.name, 'darwin')
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
PLATFORM: ${{ matrix.platform.name }}

View file

@ -19,59 +19,23 @@ jobs:
# name: linux+aarch64
container: ${{ matrix.platform.container }}
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2
with:
version: 7
- name: setup node
uses: actions/setup-node@v1
with:
node-version: 18
cache: 'pnpm'
cache-dependency-path: pnpm-lock.yaml
- name: install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/checkout@v3
- name: build platform output
id: build_platform
env:
platform: ${{ matrix.platform.name }}
run: |
BUILD_PLATFORM=$(echo $platform | sed -e "s/darwin+//g" | sed -e "s/linux+//g")
EXTENSION=dmg
BUILD_PLATFORM=$(echo $platform | sed -e "s/darwin+//g" | sed -e "s/linux+//g")
[[ $BUILD_PLATFORM = "x86-64" ]] && BUILD_PLATFORM="x64" || BUILD_PLATFORM=$BUILD_PLATFORM
[[ $platform = "linux+x86-64" ]] && BUILD_PLATFORM="amd64" || BUILD_PLATFORM=$BUILD_PLATFORM
[[ $platform = "linux+x86-64" ]] && EXTENSION="deb"
echo "build_platform=$BUILD_PLATFORM" >> $GITHUB_OUTPUT
echo "extension=$EXTENSION" >> $GITHUB_OUTPUT
- uses: Swatinem/rust-cache@v2
with:
# The prefix cache key, this can be changed to start a new cache manually.
# default: "v0-rust"
prefix-key: ${{ matrix.platform.name }}
shared-key: prod
cache-targets: false
- name: install dependencies (ubuntu only)
if: matrix.platform.name == 'linux+x86-64'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
- name: install app dependencies
run: pnpm install
- name: Cache Tauri Target
uses: actions/cache@v3
with:
path: |
./modules/gui/src-tauri/target
key: ${{ matrix.platform.name }}-build-target-prod
restore-keys: |
${{ matrix.platform.name }}-build-target-prod
- name: test build tauri for MacOS
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
- name: build tauri for MacOS
uses: teaxyz/setup@v0
if: startsWith(matrix.platform.name, 'darwin')
# FROM: https://tauri.app/v1/guides/distribution/sign-macos
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -79,14 +43,21 @@ jobs:
APPLE_CERTIFICATE: ${{ secrets.GUI_APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.GUI_APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
run: pnpm build:gui
# todo: uncomment when m1 with latest xcode is deployed
# this only helps in notarization
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
with:
target: build
- name: test build tauri for Linux
if: matrix.platform.name == 'linux+x86-64'
- name: build tauri for Linux
# uses: teaxyz/setup@v0
if: startsWith(matrix.platform.name, 'linux')
# TODO: https://tauri.app/v1/guides/distribution/sign-linux
run: pnpm build:gui
run: |
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf pkg-config
sh <(curl https://tea.xyz) build
- name: Get current unix ts - seconds
id: date
@ -114,12 +85,12 @@ jobs:
"s3://preview.gui.tea.xyz/release/tea_gui_$tag_$platform.$extension"
- name: zip .app for MacOS
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
if: startsWith(matrix.platform.name, 'darwin')
run: |
cd ./modules/gui/src-tauri/target/release/bundle/macos/ && zip -r tea.zip tea.app
- name: publish .zip(.app) for MacOS
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
if: startsWith(matrix.platform.name, 'darwin')
env:
platform: ${{ steps.build_platform.outputs.build_platform }}
extension: ${{ steps.build_platform.outputs.extension }}
@ -129,6 +100,9 @@ jobs:
"s3://preview.gui.tea.xyz/release/tea_gui_latest_$platform.zip"
aws s3 cp "./modules/gui/src-tauri/target/release/bundle/macos/tea.zip" \
"s3://preview.gui.tea.xyz/release/tea_gui_$tag_$platform.zip"
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Slack Notification
run: ./.github/notify-slack.js
env:
@ -140,7 +114,7 @@ jobs:
- name: Slack Notification for .app Mac
run: ./.github/notify-slack.js
if: matrix.platform.name == 'darwin+x86-64' || matrix.platform.name == 'darwin+aarch64'
if: startsWith(matrix.platform.name, 'darwin')
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
PLATFORM: ${{ matrix.platform.name }}

View file

@ -134,9 +134,9 @@
"fullscreen": false,
"height": 600,
"resizable": true,
"title": "gui",
"title": "tea",
"width": 1200,
"decorations": false
"decorations": true
}
]
}

View file

@ -15,6 +15,8 @@
html {
background-color: #1a1a1a;
color: #fff;
user-select: none;
cursor: default;
}
@layer base {

View file

@ -1,6 +1,5 @@
<script lang="ts">
import { page } from '$app/stores';
import { appWindow } from '@tauri-apps/api/window';
import { searchStore } from '$libs/stores';
import SearchInput from '@tea/ui/SearchInput/SearchInput.svelte';
import Button from '@tea/ui/Button/Button.svelte';
@ -8,16 +7,6 @@
import { beforeUpdate } from 'svelte';
let maximized = false;
const toggleMaximize = () => {
maximized = !maximized;
if (maximized) {
appWindow.maximize();
} else {
appWindow.unmaximize();
}
};
let routes = [
{
path: '/',
@ -65,18 +54,7 @@
</script>
<ul id="NavBar">
<nav data-tauri-drag-region class="flex justify-between">
<div class="flex gap-1 p-3 pt-3">
<button class="titlebar-button" id="titlebar-close" on:click={appWindow.close}>
<img src="/images/close.svg" alt="close" />
</button>
<button class="titlebar-button" id="titlebar-minimize" on:click={appWindow.minimize}>
<img src="/images/minimize.svg" alt="minimize" />
</button>
<button class="titlebar-button" id="titlebar-maximize" on:click={toggleMaximize}>
<img src="/images/expand.svg" alt="maximize" />
</button>
</div>
<nav class="flex justify-between">
<a href="/">
<img width="40" height="40" src="/images/tea-icon.png" alt="tea" />
</a>
@ -125,11 +103,6 @@
}
}
nav:hover {
transition: all 0.3s;
background-color: #2d2d2d;
}
.titlebar-button {
display: inline-flex;
justify-content: center;

View file

@ -3,7 +3,6 @@ import Fuse from 'fuse.js';
import type { Package, Review, AirtablePost } from '@tea/ui/types';
import type { GUIPackage } from '$libs/types';
// TODO: figure out a better structure for managing states maybe turn them into separate files?
import { getPackages, getFeaturedPackages, getPackageReviews, getAllPosts } from '@api';
import initAuthStore from './stores/auth';