mirror of
https://github.com/Vikeo/LifeTrinket.git
synced 2025-11-12 14:16:21 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
481196de9b | ||
|
|
a136dbd3f9 | ||
|
|
8d23349dac | ||
|
|
a7caa46156 | ||
|
|
39cd3faae2 | ||
|
|
bdaa8e602f | ||
|
|
26490103a9 | ||
|
|
56b07784d5 | ||
|
|
4544c689a5 | ||
|
|
8a7a4b4127 | ||
|
|
391e654779 | ||
|
|
f79a0d3e7e | ||
|
|
0664e340a0 | ||
|
|
dcb98aeac6 | ||
|
|
89b62ddac4 | ||
|
|
c704e3c7f4 | ||
|
|
69a71e2d6e | ||
|
|
18945204bf | ||
|
|
495e731636 | ||
|
|
67b231f0d4 | ||
|
|
9d42fb1635 |
20
.github/workflows/firebase-hosting-mege.yml
vendored
20
.github/workflows/firebase-hosting-mege.yml
vendored
@@ -1,20 +0,0 @@
|
|||||||
# This file was auto-generated by the Firebase CLI
|
|
||||||
# https://github.com/firebase/firebase-tools
|
|
||||||
name: Deploy to Firebase Hosting on merge
|
|
||||||
'on':
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
jobs:
|
|
||||||
build_and_deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
- uses: oven-sh/setup-bun@v1
|
|
||||||
- run: bun install && bun run build && bun run lint
|
|
||||||
- uses: FirebaseExtended/action-hosting-deploy@v0
|
|
||||||
with:
|
|
||||||
repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
|
||||||
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_LIFE_TRINKET }}'
|
|
||||||
channelId: live
|
|
||||||
projectId: life-trinket
|
|
||||||
58
.github/workflows/firebase-release.yml
vendored
Normal file
58
.github/workflows/firebase-release.yml
vendored
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
name: Deploy to Firebase Hosting
|
||||||
|
'on':
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- '*'
|
||||||
|
jobs:
|
||||||
|
# build_and_deploy:
|
||||||
|
# runs-on: ubuntu-latest
|
||||||
|
# env:
|
||||||
|
# REPO_READ_ACCESS_TOKEN: ${{ secrets.REPO_READ_ACCESS_TOKEN }}
|
||||||
|
# steps:
|
||||||
|
# - name: Checkout repository
|
||||||
|
# uses: actions/checkout@v3
|
||||||
|
|
||||||
|
# - name: Setup bun
|
||||||
|
# uses: oven-sh/setup-bun@v1
|
||||||
|
|
||||||
|
# - name: Build, lint, and deploy
|
||||||
|
# run: |
|
||||||
|
# bun install
|
||||||
|
# bun run build
|
||||||
|
# bun run lint
|
||||||
|
# - name: Deploy to Firebase Hosting
|
||||||
|
# uses: FirebaseExtended/action-hosting-deploy@v0
|
||||||
|
# with:
|
||||||
|
# repoToken: '${{ secrets.GITHUB_TOKEN }}'
|
||||||
|
# firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_LIFE_TRINKET }}'
|
||||||
|
# channelId: live
|
||||||
|
# projectId: life-trinket
|
||||||
|
|
||||||
|
release:
|
||||||
|
# needs: build_and_deploy
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
working-directory: ${{ github.workspace }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: get version
|
||||||
|
id: version
|
||||||
|
uses: notiz-dev/github-action-json-property@v0.2.0
|
||||||
|
|
||||||
|
with:
|
||||||
|
path: 'package.json'
|
||||||
|
prop_path: 'version'
|
||||||
|
|
||||||
|
- name: Create Release Note
|
||||||
|
id: create_release_note
|
||||||
|
run: echo "Release Note for version ${{ steps.version.outputs.prop }}" > release_note.txt
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
uses: ncipollo/release-action@v1.13.0
|
||||||
|
with:
|
||||||
|
body: release_note.txt
|
||||||
|
commit: ${{ github.sha }}
|
||||||
|
tag: '${{ steps.version.outputs.prop }}'
|
||||||
|
token: ${{ secrets.RELEASE_TOKEN }}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "life-trinket",
|
"name": "life-trinket",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.5.0",
|
"version": "0.5.3",
|
||||||
"type": "commonjs",
|
"type": "commonjs",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18",
|
"node": ">=18",
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import { useGlobalSettings } from '../../Hooks/useGlobalSettings';
|
|||||||
import { ModalWrapper } from './InfoModal';
|
import { ModalWrapper } from './InfoModal';
|
||||||
import { Separator } from './Separator';
|
import { Separator } from './Separator';
|
||||||
import { Paragraph } from './TextComponents';
|
import { Paragraph } from './TextComponents';
|
||||||
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
|
||||||
const SettingContainer = twc.div`w-full flex flex-col`;
|
const SettingContainer = twc.div`w-full flex flex-col`;
|
||||||
|
|
||||||
@@ -20,6 +21,47 @@ type SettingsModalProps = {
|
|||||||
|
|
||||||
export const SettingsModal = ({ isOpen, closeModal }: SettingsModalProps) => {
|
export const SettingsModal = ({ isOpen, closeModal }: SettingsModalProps) => {
|
||||||
const { settings, setSettings, isPWA } = useGlobalSettings();
|
const { settings, setSettings, isPWA } = useGlobalSettings();
|
||||||
|
const [isLatestVersion, setIsLatestVersion] = useState(false);
|
||||||
|
const newVersion = useRef<string | undefined>(undefined);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (!isOpen) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
async function checkIfLatestVersion() {
|
||||||
|
try {
|
||||||
|
const result = await fetch(
|
||||||
|
'https://api.github.com/repos/Vikeo/LifeTrinket/releases/latest',
|
||||||
|
{
|
||||||
|
headers: {
|
||||||
|
/* @ts-expect-error is defined in vite.config.ts*/
|
||||||
|
Authorization: `Bearer ${REPO_READ_ACCESS_TOKEN}`,
|
||||||
|
Accept: 'application/vnd.github+json',
|
||||||
|
'X-GitHub-Api-Version': '2022-11-28',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
);
|
||||||
|
const data = await result.json();
|
||||||
|
|
||||||
|
if (!data.name) {
|
||||||
|
setIsLatestVersion(false);
|
||||||
|
newVersion.current = undefined;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @ts-expect-error is defined in vite.config.ts*/
|
||||||
|
if (data.name === APP_VERSION) {
|
||||||
|
newVersion.current = data.name;
|
||||||
|
setIsLatestVersion(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setIsLatestVersion(false);
|
||||||
|
} catch (error) {
|
||||||
|
console.error('error getting latest version string', error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
checkIfLatestVersion();
|
||||||
|
}, [isOpen]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal open={isOpen} onClose={closeModal}>
|
<Modal open={isOpen} onClose={closeModal}>
|
||||||
@@ -98,18 +140,36 @@ export const SettingsModal = ({ isOpen, closeModal }: SettingsModalProps) => {
|
|||||||
)}
|
)}
|
||||||
<Separator height="1px" />
|
<Separator height="1px" />
|
||||||
<SettingContainer>
|
<SettingContainer>
|
||||||
|
<Paragraph>
|
||||||
{/* @ts-expect-error is defined in vite.config.ts*/}
|
{/* @ts-expect-error is defined in vite.config.ts*/}
|
||||||
<Paragraph>Version: {APP_VERSION}</Paragraph>
|
Current version: {APP_VERSION}{' '}
|
||||||
|
{isLatestVersion && (
|
||||||
|
<span className="text-sm text-text-secondary">(latest)</span>
|
||||||
|
)}
|
||||||
|
</Paragraph>
|
||||||
|
{!isLatestVersion && newVersion.current && (
|
||||||
|
<Paragraph className="text-text-secondary text-lg text-center">
|
||||||
|
New version ({newVersion.current}) is available!{' '}
|
||||||
|
</Paragraph>
|
||||||
|
)}
|
||||||
|
</SettingContainer>
|
||||||
|
{!isLatestVersion && newVersion.current && (
|
||||||
<Button
|
<Button
|
||||||
variant="contained"
|
variant="contained"
|
||||||
|
style={{ marginTop: '0.25rem', marginBottom: '0.25rem' }}
|
||||||
onClick={() => window?.location?.reload()}
|
onClick={() => window?.location?.reload()}
|
||||||
>
|
>
|
||||||
Try to update version
|
<span>Update</span>
|
||||||
|
<span className="text-xs"> (reload app)</span>
|
||||||
</Button>
|
</Button>
|
||||||
</SettingContainer>
|
)}
|
||||||
<Separator height="1px" />
|
<Separator height="1px" />
|
||||||
|
|
||||||
<Button variant="contained" onClick={closeModal}>
|
<Button
|
||||||
|
variant="contained"
|
||||||
|
onClick={closeModal}
|
||||||
|
style={{ marginTop: '0.25rem' }}
|
||||||
|
>
|
||||||
Save and Close
|
Save and Close
|
||||||
</Button>
|
</Button>
|
||||||
</Container>
|
</Container>
|
||||||
|
|||||||
@@ -12,5 +12,6 @@ export default defineConfig({
|
|||||||
},
|
},
|
||||||
define: {
|
define: {
|
||||||
APP_VERSION: JSON.stringify(process.env.npm_package_version),
|
APP_VERSION: JSON.stringify(process.env.npm_package_version),
|
||||||
|
REPO_READ_ACCESS_TOKEN: JSON.stringify(process.env.REPO_READ_ACCESS_TOKEN),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user