Merge pull request 'Release' (#310) from staging into main
Some checks failed
Release to Production / build_and_release (push) Failing after 2m8s
Some checks failed
Release to Production / build_and_release (push) Failing after 2m8s
Reviewed-on: #310
This commit is contained in:
commit
d72250b6dc
@ -26,9 +26,27 @@ jobs:
|
|||||||
- name: Create Build
|
- name: Create Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- name: Release Build
|
- name: Deploy Build
|
||||||
run: |
|
run: |
|
||||||
npm -g install cloudron-surfer
|
npm -g install cloudron-surfer
|
||||||
surfer config --token ${{ secrets.CLOUDRON_SURFER_TOKEN }} --server sigit.io
|
surfer config --token ${{ secrets.CLOUDRON_SURFER_TOKEN }} --server sigit.io
|
||||||
surfer put dist/* / --all -d
|
surfer put dist/* / --all -d
|
||||||
surfer put dist/.well-known / --all
|
surfer put dist/.well-known / --all
|
||||||
|
|
||||||
|
- name: Create Empty Release (assets are posted later)
|
||||||
|
run: |
|
||||||
|
npm i
|
||||||
|
npm i -g semantic-release
|
||||||
|
# We do a semantic-release DRY RUN to make the job fail if there are no changes to release
|
||||||
|
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.nostrdev.com/sigit/sigit.io semantic-release --dry-run | grep -q "There are no relevant changes, so no new version is released." && exit 1
|
||||||
|
GITEA_TOKEN=${{ secrets.RELEASE_TOKEN }} GITEA_URL=https://git.nostrdev.com/sigit/sigit.io semantic-release
|
||||||
|
|
||||||
|
- name: Upload assets to release
|
||||||
|
run: |
|
||||||
|
RELEASE_ID=`curl -k 'https://git.nostrdev.com/sigit/sigit.io/api/v1/repos/sigit/sigit.io/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.id'`
|
||||||
|
RELEASE_BODY=`curl -k 'https://git.nostrdev.com/sigit/sigit.io/api/v1/repos/sigit/sigit.io/releases/latest?access_token=${{ secrets.RELEASE_TOKEN }}' | jq -r '.body'`
|
||||||
|
# Update body
|
||||||
|
curl --data '{"draft": false,"body":"'"$RELEASE_BODY\n\nFor installation instructions, please visit https://docs.sigit.io/#/"'"}' -X PATCH --header 'Content-Type: application/json' -k https://git.nostrdev.com/sigit/sigit.io/api/v1/repos/sigit/sigit.io/releases/$RELEASE_ID?access_token=${{ secrets.RELEASE_TOKEN }}
|
||||||
|
# Upload assets
|
||||||
|
URL="https://git.nostrdev.com/sigit/sigit.io/api/v1/repos/sigit/sigit.io/releases/$RELEASE_ID/assets?access_token=${{ secrets.RELEASE_TOKEN }}"
|
||||||
|
curl -k $URL -F attachment=@dist.zip
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -8,7 +8,7 @@ pnpm-debug.log*
|
|||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist-zip
|
||||||
dist-ssr
|
dist-ssr
|
||||||
*.local
|
*.local
|
||||||
|
|
||||||
|
31
.releaserc
Normal file
31
.releaserc
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"branches": [
|
||||||
|
"main"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"@semantic-release/commit-analyzer",
|
||||||
|
"@semantic-release/release-notes-generator",
|
||||||
|
"@semantic-release/changelog",
|
||||||
|
"@semantic-release/npm",
|
||||||
|
[
|
||||||
|
"@semantic-release/git",
|
||||||
|
{
|
||||||
|
"assets": [
|
||||||
|
"CHANGELOG.md",
|
||||||
|
"package.json"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"@saithodev/semantic-release-gitea",
|
||||||
|
{
|
||||||
|
"giteaUrl": "https://git.nostrdev.com/sigit/sigit.io",
|
||||||
|
"assets": [
|
||||||
|
{
|
||||||
|
"path": "dist-zip/dist.zip"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]
|
||||||
|
}
|
8714
package-lock.json
generated
8714
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
11
package.json
11
package.json
@ -17,7 +17,8 @@
|
|||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"preinstall": "git config core.hooksPath .git-hooks",
|
"preinstall": "git config core.hooksPath .git-hooks",
|
||||||
"license-checker": "node licenseChecker.cjs",
|
"license-checker": "node licenseChecker.cjs",
|
||||||
"lint-staged": "lint-staged"
|
"lint-staged": "lint-staged",
|
||||||
|
"release": "commit-and-tag-version"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@emotion/react": "11.11.4",
|
"@emotion/react": "11.11.4",
|
||||||
@ -65,6 +66,12 @@
|
|||||||
"use-immer": "^0.11.0"
|
"use-immer": "^0.11.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@saithodev/semantic-release-gitea": "^2.1.0",
|
||||||
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
|
"@semantic-release/commit-analyzer": "^10.0.1",
|
||||||
|
"@semantic-release/git": "^10.0.1",
|
||||||
|
"@semantic-release/npm": "11.0.0",
|
||||||
|
"@semantic-release/release-notes-generator": "^11.0.4",
|
||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/file-saver": "2.0.7",
|
"@types/file-saver": "2.0.7",
|
||||||
"@types/lodash": "4.14.202",
|
"@types/lodash": "4.14.202",
|
||||||
@ -75,6 +82,7 @@
|
|||||||
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
"@typescript-eslint/eslint-plugin": "^7.0.2",
|
||||||
"@typescript-eslint/parser": "^7.0.2",
|
"@typescript-eslint/parser": "^7.0.2",
|
||||||
"@vitejs/plugin-react": "^4.2.1",
|
"@vitejs/plugin-react": "^4.2.1",
|
||||||
|
"commit-and-tag-version": "^11.2.2",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.56.0",
|
||||||
"eslint-plugin-react-hooks": "^4.6.0",
|
"eslint-plugin-react-hooks": "^4.6.0",
|
||||||
"eslint-plugin-react-refresh": "^0.4.5",
|
"eslint-plugin-react-refresh": "^0.4.5",
|
||||||
@ -85,6 +93,7 @@
|
|||||||
"typescript": "^5.2.2",
|
"typescript": "^5.2.2",
|
||||||
"vite": "^5.1.4",
|
"vite": "^5.1.4",
|
||||||
"vite-plugin-node-polyfills": "^0.22.0",
|
"vite-plugin-node-polyfills": "^0.22.0",
|
||||||
|
"vite-plugin-zip-pack": "^1.2.4",
|
||||||
"vite-tsconfig-paths": "4.3.2"
|
"vite-tsconfig-paths": "4.3.2"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
|
@ -16,6 +16,7 @@ interface FileListProps {
|
|||||||
setCurrentFile: (file: CurrentUserFile) => void
|
setCurrentFile: (file: CurrentUserFile) => void
|
||||||
handleExport?: () => void
|
handleExport?: () => void
|
||||||
handleEncryptedExport?: () => void
|
handleEncryptedExport?: () => void
|
||||||
|
reBroadcastSigit?: () => void
|
||||||
}
|
}
|
||||||
|
|
||||||
const FileList = ({
|
const FileList = ({
|
||||||
@ -23,7 +24,8 @@ const FileList = ({
|
|||||||
currentFile,
|
currentFile,
|
||||||
setCurrentFile,
|
setCurrentFile,
|
||||||
handleExport,
|
handleExport,
|
||||||
handleEncryptedExport
|
handleEncryptedExport,
|
||||||
|
reBroadcastSigit
|
||||||
}: FileListProps) => {
|
}: FileListProps) => {
|
||||||
const isActive = (file: CurrentUserFile) => file.id === currentFile.id
|
const isActive = (file: CurrentUserFile) => file.id === currentFile.id
|
||||||
return (
|
return (
|
||||||
@ -91,6 +93,12 @@ const FileList = ({
|
|||||||
)}
|
)}
|
||||||
</PopupState>
|
</PopupState>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{typeof reBroadcastSigit === 'function' && (
|
||||||
|
<Button variant="contained" onClick={reBroadcastSigit}>
|
||||||
|
Re-Broadcast
|
||||||
|
</Button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,8 @@ import {
|
|||||||
ARRAY_BUFFER,
|
ARRAY_BUFFER,
|
||||||
DEFLATE,
|
DEFLATE,
|
||||||
uploadMetaToFileStorage,
|
uploadMetaToFileStorage,
|
||||||
decrypt
|
decrypt,
|
||||||
|
SignStatus
|
||||||
} from '../../utils'
|
} from '../../utils'
|
||||||
import styles from './style.module.scss'
|
import styles from './style.module.scss'
|
||||||
import { useLocation, useParams } from 'react-router-dom'
|
import { useLocation, useParams } from 'react-router-dom'
|
||||||
@ -217,6 +218,7 @@ export const VerifyPage = () => {
|
|||||||
encryptionKey,
|
encryptionKey,
|
||||||
signers,
|
signers,
|
||||||
viewers,
|
viewers,
|
||||||
|
signersStatus,
|
||||||
fileHashes,
|
fileHashes,
|
||||||
parsedSignatureEvents,
|
parsedSignatureEvents,
|
||||||
timestamps
|
timestamps
|
||||||
@ -732,6 +734,76 @@ export const VerifyPage = () => {
|
|||||||
return Promise.resolve(arrayBuffer)
|
return Promise.resolve(arrayBuffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const reBroadcastSigit = async () => {
|
||||||
|
const usersNpub = hexToNpub(usersPubkey!)
|
||||||
|
|
||||||
|
if (!encryptionKey) {
|
||||||
|
toast.error('Encryption key is missing')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
setIsLoading(true)
|
||||||
|
setLoadingSpinnerDesc('storing meta on blossom server')
|
||||||
|
|
||||||
|
let metaUrl: string
|
||||||
|
try {
|
||||||
|
metaUrl = await uploadMetaToFileStorage(meta, encryptionKey)
|
||||||
|
} catch (error) {
|
||||||
|
if (error instanceof Error) {
|
||||||
|
toast.error(error.message)
|
||||||
|
}
|
||||||
|
console.error(error)
|
||||||
|
setIsLoading(false)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const userSet = new Set<`npub1${string}`>()
|
||||||
|
if (submittedBy && submittedBy !== usersPubkey) {
|
||||||
|
userSet.add(hexToNpub(submittedBy))
|
||||||
|
}
|
||||||
|
|
||||||
|
// add all the signers who have signed and next signer to userSet
|
||||||
|
signers.forEach((signer) => {
|
||||||
|
// skip current user
|
||||||
|
if (signer === usersNpub) return
|
||||||
|
|
||||||
|
if (signersStatus[signer] === SignStatus.Signed) {
|
||||||
|
userSet.add(signer)
|
||||||
|
} else if (signersStatus[signer] === SignStatus.Awaiting) {
|
||||||
|
userSet.add(signer)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
// If all signers have signed then include viewers too
|
||||||
|
if (
|
||||||
|
signers.every((signer) => signersStatus[signer] === SignStatus.Signed)
|
||||||
|
) {
|
||||||
|
viewers.forEach((viewer) => {
|
||||||
|
// skip current user
|
||||||
|
if (viewer === usersNpub) return
|
||||||
|
|
||||||
|
userSet.add(viewer)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
setLoadingSpinnerDesc('Sending notifications')
|
||||||
|
const users = Array.from(userSet)
|
||||||
|
const promises = users.map((user) =>
|
||||||
|
sendNotification(npubToHex(user)!, { metaUrl, keys: meta.keys })
|
||||||
|
)
|
||||||
|
|
||||||
|
await Promise.all(promises)
|
||||||
|
.then(() => {
|
||||||
|
toast.success('Notifications sent successfully')
|
||||||
|
setMeta(meta)
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
toast.error('Failed to publish notifications')
|
||||||
|
})
|
||||||
|
|
||||||
|
setIsLoading(false)
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{isLoading && <LoadingSpinner desc={loadingSpinnerDesc} />}
|
{isLoading && <LoadingSpinner desc={loadingSpinnerDesc} />}
|
||||||
@ -780,6 +852,7 @@ export const VerifyPage = () => {
|
|||||||
setCurrentFile={setCurrentFile}
|
setCurrentFile={setCurrentFile}
|
||||||
handleExport={handleExport}
|
handleExport={handleExport}
|
||||||
handleEncryptedExport={handleEncryptedExport}
|
handleEncryptedExport={handleEncryptedExport}
|
||||||
|
reBroadcastSigit={reBroadcastSigit}
|
||||||
/>
|
/>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import { defineConfig } from 'vite'
|
|||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
import tsconfigPaths from 'vite-tsconfig-paths'
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
||||||
import { nodePolyfills } from 'vite-plugin-node-polyfills'
|
import { nodePolyfills } from 'vite-plugin-node-polyfills'
|
||||||
|
import zipPack from 'vite-plugin-zip-pack'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
@ -9,7 +10,8 @@ export default defineConfig({
|
|||||||
tsconfigPaths(),
|
tsconfigPaths(),
|
||||||
nodePolyfills({
|
nodePolyfills({
|
||||||
include: ['os']
|
include: ['os']
|
||||||
})
|
}),
|
||||||
|
zipPack()
|
||||||
],
|
],
|
||||||
build: {
|
build: {
|
||||||
target: 'ES2022'
|
target: 'ES2022'
|
||||||
|
Loading…
x
Reference in New Issue
Block a user