mirror of
https://github.com/ivabus/gui
synced 2025-06-07 15:50:27 +03:00
Merge pull request #110 from teaxyz/cleanup-stores-usage
Cleanup stores usage
This commit is contained in:
commit
c62de97053
5 changed files with 60 additions and 39 deletions
63
.github/workflows/release.yml
vendored
63
.github/workflows/release.yml
vendored
|
@ -5,12 +5,19 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build_release_tauri:
|
build_release_tauri:
|
||||||
|
runs-on: ${{ matrix.platform.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
matrix:
|
||||||
platform: [macos-latest, ubuntu-latest]
|
platform:
|
||||||
|
- os: macos-11
|
||||||
runs-on: ${{ matrix.platform }}
|
name: darwin+x86-64
|
||||||
|
- os: ubuntu-latest
|
||||||
|
name: linux+x86-64
|
||||||
|
- os: [self-hosted, macOS, ARM64]
|
||||||
|
name: darwin+aarch64
|
||||||
|
# - os: [self-hosted, linux, ARM64]
|
||||||
|
# name: linux+aarch64
|
||||||
|
container: ${{ matrix.platform.container }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
@ -27,15 +34,27 @@ jobs:
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions-rs/toolchain@v1
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
toolchain: stable
|
||||||
|
- 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 = "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
|
- uses: Swatinem/rust-cache@v2
|
||||||
with:
|
with:
|
||||||
# The prefix cache key, this can be changed to start a new cache manually.
|
# The prefix cache key, this can be changed to start a new cache manually.
|
||||||
# default: "v0-rust"
|
# default: "v0-rust"
|
||||||
prefix-key: ${{ matrix.platform }}
|
prefix-key: ${{ matrix.platform.name }}
|
||||||
shared-key: prod
|
shared-key: prod
|
||||||
cache-targets: false
|
cache-targets: false
|
||||||
- name: install dependencies (ubuntu only)
|
- name: install dependencies (ubuntu only)
|
||||||
if: matrix.platform == 'ubuntu-latest'
|
if: matrix.platform.name == 'linux+x86-64'
|
||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
sudo apt-get install -y libgtk-3-dev webkit2gtk-4.0 libappindicator3-dev librsvg2-dev patchelf
|
||||||
|
@ -47,9 +66,9 @@ jobs:
|
||||||
with:
|
with:
|
||||||
path: |
|
path: |
|
||||||
./modules/gui/src-tauri/target
|
./modules/gui/src-tauri/target
|
||||||
key: ${{ matrix.platform }}-build-target-prod
|
key: ${{ matrix.platform.name }}-build-target-prod
|
||||||
restore-keys: |
|
restore-keys: |
|
||||||
${{ matrix.platform }}-build-target-prod
|
${{ matrix.platform.name }}-build-target-prod
|
||||||
|
|
||||||
- name: test build tauri
|
- name: test build tauri
|
||||||
run: pnpm --filter gui tauri build
|
run: pnpm --filter gui tauri build
|
||||||
|
@ -67,24 +86,22 @@ jobs:
|
||||||
- name: Set tag
|
- name: Set tag
|
||||||
id: tag
|
id: tag
|
||||||
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
|
||||||
- name: UBUNTU publish release
|
|
||||||
if: matrix.platform == 'ubuntu-latest'
|
- name: publish release
|
||||||
|
env:
|
||||||
|
platform: ${{ steps.build_platform.outputs.build_platform }}
|
||||||
|
extension: ${{ steps.build_platform.outputs.extension }}
|
||||||
|
tag: ${{ steps.tag.outputs.tag }}
|
||||||
run: |
|
run: |
|
||||||
aws s3 cp ./modules/gui/src-tauri/target/release/bundle/deb/tea_0.1.0_amd64.deb \
|
aws s3 cp "./modules/gui/src-tauri/target/release/bundle/$extension/tea_0.1.0_$platform.$extension" \
|
||||||
s3://preview.gui.tea.xyz/release/tea_gui_latest.${{matrix.platform}}.deb
|
"s3://preview.gui.tea.xyz/release/tea_gui_latest_$platform.$extension"
|
||||||
aws s3 cp ./modules/gui/src-tauri/target/release/bundle/deb/tea_0.1.0_amd64.deb \
|
aws s3 cp "./modules/gui/src-tauri/target/release/bundle/$extension/tea_0.1.0_$platform.$extension" \
|
||||||
s3://preview.gui.tea.xyz/release/tea_gui_${{steps.tag.outputs.tag}}.${{matrix.platform}}.deb
|
"s3://preview.gui.tea.xyz/release/tea_gui_$tag_$platform.$extension"
|
||||||
- name: MAC INTEL publish release
|
|
||||||
if: matrix.platform == 'macos-latest'
|
|
||||||
run: |
|
|
||||||
aws s3 cp ./modules/gui/src-tauri/target/release/bundle/dmg/tea_0.1.0_x64.dmg \
|
|
||||||
s3://preview.gui.tea.xyz/release/tea_gui_latest.${{matrix.platform}}.dmg
|
|
||||||
aws s3 cp ./modules/gui/src-tauri/target/release/bundle/dmg/tea_0.1.0_x64.dmg \
|
|
||||||
s3://preview.gui.tea.xyz/release/tea_gui_${{steps.tag.outputs.tag}}.${{matrix.platform}}.dmg
|
|
||||||
- name: Slack Notification
|
- name: Slack Notification
|
||||||
run: ./.github/notify-slack.js
|
run: ./.github/notify-slack.js
|
||||||
env:
|
env:
|
||||||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
PLATFORM: ${{ matrix.platform }}
|
PLATFORM: ${{ matrix.platform.name }}
|
||||||
VERSION: ${{steps.tag.outputs.tag}}
|
VERSION: ${{steps.tag.outputs.tag}}
|
||||||
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/tea_gui_${{steps.tag.outputs.tag}}.${{matrix.platform}}.${{ matrix.platform == 'ubuntu-latest' && 'deb' || 'dmg'}}
|
DOWNLOAD_URL: http://preview.gui.tea.xyz.s3-website-us-east-1.amazonaws.com/release/tea_gui_${{steps.tag.outputs.tag}}_${{steps.build_platform.outputs.build_platform}}.${{ steps.build_platform.outputs.extension }}
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import '$appcss';
|
import '$appcss';
|
||||||
import { getAllPosts } from '@api';
|
|
||||||
import type { AirtablePost } from '@tea/ui/types';
|
import type { AirtablePost } from '@tea/ui/types';
|
||||||
import Posts from '@tea/ui/Posts/Posts.svelte';
|
import Posts from '@tea/ui/Posts/Posts.svelte';
|
||||||
import PanelHeader from '@tea/ui/PanelHeader/PanelHeader.svelte';
|
import PanelHeader from '@tea/ui/PanelHeader/PanelHeader.svelte';
|
||||||
import Preloader from '@tea/ui/Preloader/Preloader.svelte';
|
import Preloader from '@tea/ui/Preloader/Preloader.svelte';
|
||||||
import { onMount } from 'svelte';
|
import { postsStore } from '$libs/stores';
|
||||||
|
|
||||||
let courses: AirtablePost[] = [];
|
let courses: AirtablePost[] = [];
|
||||||
|
|
||||||
onMount(async () => {
|
postsStore.subscribeByTag('course', (posts) => (courses = posts));
|
||||||
courses = await getAllPosts('course');
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<PanelHeader title="Essential Workshops" ctaLabel="View all" ctaLink="/" />
|
<PanelHeader title="Essential Workshops" ctaLabel="View all" ctaLink="/" />
|
||||||
|
|
|
@ -1,17 +1,21 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import '$appcss';
|
import '$appcss';
|
||||||
import { onMount } from 'svelte';
|
import { postsStore } from '$libs/stores';
|
||||||
import type { Course } from '$libs/types';
|
import type { Course } from '$libs/types';
|
||||||
|
|
||||||
import Gallery from '@tea/ui/Gallery/Gallery.svelte';
|
import Gallery from '@tea/ui/Gallery/Gallery.svelte';
|
||||||
import { getFeaturedCourses } from '@api';
|
|
||||||
|
|
||||||
let courses: Course[] = [];
|
let courses: Course[] = [];
|
||||||
|
|
||||||
onMount(async () => {
|
postsStore.subscribeByTag('featured_course', (posts) => {
|
||||||
if (!courses.length) {
|
courses = posts.map((post) => {
|
||||||
courses = await getFeaturedCourses();
|
return {
|
||||||
}
|
title: post.title,
|
||||||
|
sub_title: post.sub_title,
|
||||||
|
banner_image_url: post.thumb_image_url,
|
||||||
|
link: post.link
|
||||||
|
} as Course;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import '$appcss';
|
import '$appcss';
|
||||||
import { getAllPosts } from '@api';
|
import { postsStore } from '$libs/stores';
|
||||||
import type { AirtablePost } from '@tea/ui/types';
|
import type { AirtablePost } from '@tea/ui/types';
|
||||||
import Posts from '@tea/ui/Posts/Posts.svelte';
|
import Posts from '@tea/ui/Posts/Posts.svelte';
|
||||||
import PanelHeader from '@tea/ui/PanelHeader/PanelHeader.svelte';
|
import PanelHeader from '@tea/ui/PanelHeader/PanelHeader.svelte';
|
||||||
import Preloader from '@tea/ui/Preloader/Preloader.svelte';
|
import Preloader from '@tea/ui/Preloader/Preloader.svelte';
|
||||||
import { onMount } from 'svelte';
|
|
||||||
|
|
||||||
let news: AirtablePost[] = [];
|
let news: AirtablePost[] = [];
|
||||||
|
|
||||||
onMount(async () => {
|
postsStore.subscribeByTag('news', (posts) => (news = posts));
|
||||||
news = await getAllPosts('news');
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<PanelHeader title="Open-source News" ctaLabel="Read more articles >" ctaLink="/" />
|
<PanelHeader title="Open-source News" ctaLabel="Read more articles >" ctaLink="/" />
|
||||||
|
|
|
@ -113,6 +113,12 @@ function initPosts() {
|
||||||
const res = postsIndex.search(term, { limit });
|
const res = postsIndex.search(term, { limit });
|
||||||
const matchingPosts: AirtablePost[] = res.map((v) => v.item);
|
const matchingPosts: AirtablePost[] = res.map((v) => v.item);
|
||||||
return matchingPosts;
|
return matchingPosts;
|
||||||
|
},
|
||||||
|
subscribeByTag: (tag: string, cb: (posts: AirtablePost[]) => void) => {
|
||||||
|
subscribe((newPosts: AirtablePost[]) => {
|
||||||
|
const filteredPosts = newPosts.filter((post) => post.tags.includes(tag));
|
||||||
|
cb(filteredPosts);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue