Skip to content

Commit e9a73a3

Browse files
authored
chore: release v1.5.5
feat: new version indicator
2 parents 37474fb + 79fa161 commit e9a73a3

File tree

7 files changed

+156
-33
lines changed

7 files changed

+156
-33
lines changed

.github/workflows/release-dev.yml

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,7 @@ jobs:
4343
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
4444
BRANCH="${{ github.ref_name }}"
4545
FULL_SHA="${{ github.sha }}"
46-
TAG="null"
47-
48-
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
49-
TAG="${{ github.ref_name }}"
50-
fi
46+
TAG=$(grep -m1 '"version":' package.json | cut -d'"' -f4)
5147
5248
COMMIT_URL="https://github.com/${{ github.repository }}/commit/$SHORT_SHA"
5349

.github/workflows/release-frontend.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ jobs:
6565
}
6666
EOF
6767
68+
- name: Generate changelog
69+
id: changelog
70+
run: |
71+
CHANGELOG=$(npx changelogen --from=${{ steps.tag.outputs.previousTag }} --to=${{ steps.tag.outputs.latestTag }})
72+
echo "CHANGELOG<<EOF" >> $GITHUB_ENV
73+
echo "$CHANGELOG" >> $GITHUB_ENV
74+
echo "EOF" >> $GITHUB_ENV
75+
6876
- name: Install dependencies and build
6977
run: |
7078
npm install
@@ -88,13 +96,17 @@ jobs:
8896
prerelease: false
8997
name: ${{ github.ref_name }}
9098
body: |
91-
🎉 Automatic release of Remnawave Frontend, v${{ github.ref_name }}
99+
🌊 Remnawave Frontend v${{ github.ref_name }}
92100
93-
This release was automatically created through GitHub Actions.
101+
<p align="center">
102+
<a href="https://t.me/remnawave" target="_blank" rel="noopener noreferrer">
103+
<img src="https://img.shields.io/badge/Join%20community-Telegram-26A5E4?style=for-the-badge&logo=telegram&logoColor=white" alt="Join community on Telegram" width="220" height="auto">
104+
</a>
105+
</p>
94106
95-
### 📝 Changes
107+
📝 Compare changes: [${{ steps.tag.outputs.previousTag }}...${{ steps.tag.outputs.latestTag }}](https://github.com/${{ github.repository }}/compare/${{ steps.tag.outputs.previousTag }}...${{ steps.tag.outputs.latestTag }})
96108
97-
✏️ Compare: [${{ steps.tag.outputs.previousTag }}...${{ steps.tag.outputs.latestTag }}](https://github.com/${{ github.repository }}/compare/${{ steps.tag.outputs.previousTag }}...${{ steps.tag.outputs.latestTag }})
109+
${{ env.CHANGELOG }}
98110
99111
### 📦 Artifacts
100112
- remnawave-frontend.zip - archive with built frontend

changelog.config.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"hideAuthorEmail": true,
3+
"noAuthors": true
4+
}

package-lock.json

Lines changed: 11 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "@remnawave/frontend",
33
"private": false,
44
"type": "module",
5-
"version": "1.5.4",
5+
"version": "1.5.5",
66
"license": "AGPL-3.0-only",
77
"author": "REMNAWAVE <github.com/remnawave>",
88
"homepage": "https://github.com/remnawave",
@@ -80,6 +80,7 @@
8080
"react-imask": "^7.6.1",
8181
"react-router-dom": "6.27.0",
8282
"recharts": "^2.15.1",
83+
"semver": "^7.7.1",
8384
"tiny-invariant": "^1.3.3",
8485
"uqr": "^0.1.2",
8586
"vite-plugin-deadfile": "^1.4.0",
@@ -100,6 +101,7 @@
100101
"@types/node": "^22.13.17",
101102
"@types/react": "^18.3.5",
102103
"@types/react-dom": "^18.3.0",
104+
"@types/semver": "^7.7.0",
103105
"@typescript-eslint/eslint-plugin": "^8.29.0",
104106
"@typescript-eslint/parser": "^8.29.0",
105107
"@vitejs/plugin-react": "^4.3.4",

src/app/layouts/dashboard/main-layout/main.layout.tsx

Lines changed: 77 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
import { AppShell, Badge, Burger, Code, Container, Group, ScrollArea, Text } from '@mantine/core'
1+
import {
2+
AppShell,
3+
Badge,
4+
Burger,
5+
Code,
6+
Container,
7+
Group,
8+
Indicator,
9+
ScrollArea,
10+
Text
11+
} from '@mantine/core'
212
import { useClickOutside, useDisclosure, useMediaQuery } from '@mantine/hooks'
313
import { useQuery } from '@tanstack/react-query'
414
import { useEffect, useState } from 'react'
515
import { Outlet } from 'react-router-dom'
16+
import semver from 'semver'
617
import axios from 'axios'
718

819
import { getBuildInfo } from '@shared/utils/get-build-info/get-build-info.util'
@@ -21,6 +32,15 @@ export function MainLayout() {
2132
const [buildInfoModalOpened, setBuildInfoModalOpened] = useState(false)
2233
const [isMediaQueryReady, setIsMediaQueryReady] = useState(false)
2334

35+
const [versions, setVersions] = useState<{
36+
currentVersion: string
37+
latestVersion: string
38+
}>({
39+
currentVersion: '0.0.0',
40+
latestVersion: '0.0.0'
41+
})
42+
const [isNewVersionAvailable, setIsNewVersionAvailable] = useState(false)
43+
2444
const buildInfo = getBuildInfo()
2545

2646
const isMobile = useMediaQuery(`(max-width: 64rem)`, undefined, {
@@ -52,6 +72,31 @@ export function MainLayout() {
5272
}
5373
})
5474

75+
const { data: latestVersion } = useQuery({
76+
queryKey: ['github-latest-version'],
77+
staleTime: sToMs(3600),
78+
refetchInterval: sToMs(3600),
79+
queryFn: async () => {
80+
const response = await axios.get<{
81+
release: {
82+
tag: string
83+
}
84+
}>('https://ungh.cc/repos/remnawave/panel/releases/latest')
85+
return response.data.release.tag
86+
}
87+
})
88+
89+
useEffect(() => {
90+
setVersions({
91+
currentVersion: buildInfo.tag ?? '0.0.0',
92+
latestVersion: latestVersion ?? '0.0.0'
93+
})
94+
}, [latestVersion, buildInfo.tag])
95+
96+
useEffect(() => {
97+
setIsNewVersionAvailable(semver.gt(versions.latestVersion, versions.currentVersion))
98+
}, [versions])
99+
55100
return isMediaQueryReady ? (
56101
<AppShell
57102
header={{ height: 64 }}
@@ -116,27 +161,41 @@ export function MainLayout() {
116161
</Text>
117162
</Group>
118163
{buildInfo.branch === 'dev' && (
119-
<Badge
120-
color="red"
121-
onClick={() => setBuildInfoModalOpened(true)}
122-
radius="sm"
123-
size="lg"
124-
style={{ cursor: 'help', marginLeft: 'auto' }}
125-
variant="light"
164+
<Indicator
165+
color="cyan"
166+
disabled={!isNewVersionAvailable}
167+
processing
168+
size={11}
126169
>
127-
dev
128-
</Badge>
170+
<Badge
171+
color="red"
172+
onClick={() => setBuildInfoModalOpened(true)}
173+
radius="sm"
174+
size="lg"
175+
style={{ cursor: 'help', marginLeft: 'auto' }}
176+
variant="light"
177+
>
178+
dev
179+
</Badge>
180+
</Indicator>
129181
)}
130182

131183
{buildInfo.branch !== 'dev' && (
132-
<Code
133-
c="cyan"
134-
fw={700}
135-
onClick={() => setBuildInfoModalOpened(true)}
136-
style={{ cursor: 'pointer', marginLeft: 'auto' }}
184+
<Indicator
185+
color="cyan"
186+
disabled={!isNewVersionAvailable}
187+
processing
188+
size={11}
137189
>
138-
{`v${packageJson.version}`}
139-
</Code>
190+
<Code
191+
c="cyan"
192+
fw={700}
193+
onClick={() => setBuildInfoModalOpened(true)}
194+
style={{ cursor: 'pointer', marginLeft: 'auto' }}
195+
>
196+
{`v${packageJson.version}`}
197+
</Code>
198+
</Indicator>
140199
)}
141200

142201
{isSocialButton && (
@@ -175,6 +234,7 @@ export function MainLayout() {
175234

176235
<BuildInfoModal
177236
buildInfo={buildInfo}
237+
isNewVersionAvailable={isNewVersionAvailable}
178238
onClose={() => setBuildInfoModalOpened(false)}
179239
opened={buildInfoModalOpened}
180240
/>

src/shared/ui/build-info-modal/build-info-modal.tsx

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,39 @@ import {
55
TbCheck as IconCheck,
66
TbCopy as IconCopy,
77
TbGitBranch as IconGitBranch,
8-
TbHash as IconHash
8+
TbHash as IconHash,
9+
TbRipple
910
} from 'react-icons/tb'
10-
import { Badge, Box, Button, Code, Group, Modal, Stack, Text, Title, Tooltip } from '@mantine/core'
11+
import {
12+
Alert,
13+
Badge,
14+
Box,
15+
Button,
16+
Code,
17+
Group,
18+
Modal,
19+
Stack,
20+
Text,
21+
Title,
22+
Tooltip
23+
} from '@mantine/core'
1124
import { useClipboard } from '@mantine/hooks'
1225

1326
import { IBuildInfo } from '@shared/utils/get-build-info/interfaces/build-info.interface'
1427

1528
interface BuildInfoModalProps {
1629
buildInfo: IBuildInfo
30+
isNewVersionAvailable: boolean
1731
onClose: () => void
1832
opened: boolean
1933
}
2034

21-
export function BuildInfoModal({ opened, onClose, buildInfo }: BuildInfoModalProps) {
35+
export function BuildInfoModal({
36+
opened,
37+
onClose,
38+
buildInfo,
39+
isNewVersionAvailable
40+
}: BuildInfoModalProps) {
2241
const buildDate = new Date(buildInfo.buildTime).toLocaleString()
2342
const clipboard = useClipboard({ timeout: 1000 })
2443

@@ -54,6 +73,28 @@ export function BuildInfoModal({ opened, onClose, buildInfo }: BuildInfoModalPro
5473
withCloseButton
5574
>
5675
<Stack gap="md">
76+
{isNewVersionAvailable && (
77+
<Alert
78+
color="teal"
79+
icon={<TbRipple size={22} />}
80+
title="Update available"
81+
variant="outline"
82+
>
83+
<Text size="sm">A new version of Remnawave is available.</Text>
84+
<Button
85+
color="cyan"
86+
component="a"
87+
href={'https://github.com/remnawave/panel/releases/latest'}
88+
mt="xs"
89+
size="xs"
90+
target="_blank"
91+
variant="outline"
92+
>
93+
Check out
94+
</Button>
95+
</Alert>
96+
)}
97+
5798
<Group align="flex-start">
5899
<IconCalendar size={20} />
59100
<Box>

0 commit comments

Comments
 (0)