diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6395132..e806024 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,9 +4,16 @@ name: Build on: push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + tags: + - 'v*.*.*' + # push: + # branches: [ "main" ] + # pull_request: + # branches: [ "main" ] + +permissions: + contents: write + pull-requests: read jobs: @@ -14,7 +21,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - + + - name: Set env + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: Set up Go uses: actions/setup-go@v4 with: @@ -27,3 +37,14 @@ jobs: - name: Build run: ./build.sh + + - uses: "marvinpinto/action-automatic-releases@latest" + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + automatic_release_tag: "${{ env.RELEASE_VERSION }}" + prerelease: false + title: "Automatic Build" + files: | + LICENSE + README.md + tapemanager-linux-amd64-${{ env.RELEASE_VERSION }}.tar.gz diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/build.sh b/build.sh index 796fcc8..0584139 100755 --- a/build.sh +++ b/build.sh @@ -10,8 +10,12 @@ mkdir -p output; cp -r scripts ./output/; cp ./cmd/tape-httpd/tape-writer.service ./output/ cp ./cmd/tape-httpd/config.example.yaml ./output/ +cp ./LICENSE ./output/ +cp ./README.md ./output/ # docker run --rm -v $(pwd):/app golang:1.21 sh -c "cd /app && bash " # docker run --rm -v $(pwd):/app node:20-slim sh -c "cd /app && bash build_frontend.sh" ./build_backend.sh ./build_frontend.sh + +tar -czvf tapemanager-linux-amd64-${RELEASE_VERSION}.tar.gz ./output/* diff --git a/frontend/package.json b/frontend/package.json index d17da40..3458f61 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -10,6 +10,8 @@ "gen-proto": "protoc --ts_out ./src/entity --proto_path ../entity/ `ls ../entity/*.proto` && ./src/entity/gen_index.sh" }, "dependencies": { + "@aperturerobotics/chonky": "^0.2.6", + "@aperturerobotics/chonky-icon-fontawesome": "^0.2.2", "@emotion/react": "^11.10.4", "@emotion/styled": "^11.10.4", "@fortawesome/fontawesome-svg-core": "^1.2.32", @@ -23,8 +25,6 @@ "@protobuf-ts/grpcweb-transport": "^2.8.2", "@protobuf-ts/runtime": "^2.8.2", "@protobuf-ts/runtime-rpc": "^2.8.2", - "chonky": "^2.3.2", - "chonky-icon-fontawesome": "^2.3.2", "fast-text-encoding": "^1.0.6", "filesize": "^10.0.5", "format-duration": "^2.0.0", @@ -40,15 +40,15 @@ "sort-by": "^1.2.0" }, "devDependencies": { - "@protobuf-ts/plugin": "^2.8.2", - "@types/node": "^18.11.14", - "@types/react": "^18.0.17", - "@types/react-dom": "^18.0.6", - "@vitejs/plugin-react": "^2.1.0", + "@protobuf-ts/plugin": "^2.9.1", + "@types/node": "^20.7.0", + "@types/react": "^18.2.22", + "@types/react-dom": "^18.2.7", + "@vitejs/plugin-react": "^4.1.0", "less": "^4.1.3", - "prettier": "2.7.1", + "prettier": "^3.0.3", "tsdef": "^0.0.14", - "typescript": "^4.6.4", - "vite": "^3.1.0" + "typescript": "^5.2.2", + "vite": "^4.4.9" } } diff --git a/frontend/src/actions.ts b/frontend/src/actions.ts index 33682ad..3e9aaa6 100644 --- a/frontend/src/actions.ts +++ b/frontend/src/actions.ts @@ -1,6 +1,6 @@ -import { FileData, FileArray, FileAction } from "chonky"; -import { defineFileAction } from "chonky"; -import { ChonkyActions } from "chonky"; +import { FileData, FileArray, FileAction } from "@aperturerobotics/chonky"; +import { defineFileAction } from "@aperturerobotics/chonky"; +import { ChonkyActions } from "@aperturerobotics/chonky"; type RenameFileState = { contextMenuTriggerFile: FileData; diff --git a/frontend/src/api.ts b/frontend/src/api.ts index 23b04a2..f8ef0dd 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -1,4 +1,4 @@ -import { FileData } from "chonky"; +import { FileData } from "@aperturerobotics/chonky"; import { GrpcWebFetchTransport } from "@protobuf-ts/grpcweb-transport"; import { ServiceClient, File, SourceFile } from "./entity"; diff --git a/frontend/src/init.tsx b/frontend/src/init.tsx index ea11f47..01686b6 100644 --- a/frontend/src/init.tsx +++ b/frontend/src/init.tsx @@ -1,5 +1,5 @@ -import { setChonkyDefaults } from "chonky"; -import { ChonkyIconFA } from "chonky-icon-fontawesome"; +import { setChonkyDefaults } from "@aperturerobotics/chonky"; +import { ChonkyIconFA } from "@aperturerobotics/chonky-icon-fontawesome"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faPencilAlt } from "@fortawesome/free-solid-svg-icons/faPencilAlt"; @@ -27,5 +27,5 @@ import { unstable_ClassNameGenerator as ClassNameGenerator } from "@mui/material ClassNameGenerator.configure( // Do something with the componentName - (componentName: string) => `app-${componentName}` + (componentName: string) => `app-${componentName}`, ); diff --git a/frontend/src/pages/backup.tsx b/frontend/src/pages/backup.tsx index 3f813d3..1fc2d54 100644 --- a/frontend/src/pages/backup.tsx +++ b/frontend/src/pages/backup.tsx @@ -2,8 +2,8 @@ import { useState, useEffect, useMemo, useCallback, FC, useRef, RefObject } from import Grid from "@mui/material/Grid"; import Box from "@mui/material/Box"; -import { FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray, FileBrowserHandle } from "chonky"; -import { ChonkyActions, ChonkyFileActionData, FileData } from "chonky"; +import { FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray, FileBrowserHandle } from "@aperturerobotics/chonky"; +import { ChonkyActions, ChonkyFileActionData, FileData } from "@aperturerobotics/chonky"; import { cli, convertSourceFiles } from "../api"; import { Root } from "../api"; @@ -53,7 +53,7 @@ const useBackupSourceBrowser = (source: RefObject) => { return; } }, - [openFolder, source] + [openFolder, source], ); const fileActions = useMemo(() => [ChonkyActions.StartDragNDrop, RefreshListAction], []); @@ -129,7 +129,7 @@ const useBackupTargetBrowser = () => { return; } }, - [files, setFiles] + [files, setFiles], ); const fileActions = useMemo(() => [ChonkyActions.DeleteFiles, AddFileAction, CreateBackupJobAction], []); diff --git a/frontend/src/pages/file.tsx b/frontend/src/pages/file.tsx index 44cab5e..89b7be3 100644 --- a/frontend/src/pages/file.tsx +++ b/frontend/src/pages/file.tsx @@ -2,8 +2,8 @@ import { useState, useRef, useEffect, useMemo, useCallback } from "react"; import Grid from "@mui/material/Grid"; import Box from "@mui/material/Box"; -import { FullFileBrowser, FileBrowserProps, FileBrowserHandle, FileArray } from "chonky"; -import { ChonkyActions, ChonkyFileActionData } from "chonky"; +import { FullFileBrowser, FileBrowserProps, FileBrowserHandle, FileArray } from "@aperturerobotics/chonky"; +import { ChonkyActions, ChonkyFileActionData } from "@aperturerobotics/chonky"; import { cli, convertFiles } from "../api"; import { Root } from "../api"; @@ -24,7 +24,7 @@ const useDualSide = () => { return; } return ref.current.requestFileAction(RefreshListAction, {}); - }) + }), ); }, [instances]); @@ -148,7 +148,7 @@ const useFileBrowser = (storageKey: string, refreshAll: () => Promise, ope return; } }, - [openFolder, openDetailModel, refreshAll, currentID] + [openFolder, openDetailModel, refreshAll, currentID], ); const fileActions = useMemo(() => [ChonkyActions.CreateFolder, ChonkyActions.DeleteFiles, ChonkyActions.MoveFiles, RenameFileAction, RefreshListAction], []); diff --git a/frontend/src/pages/restore.tsx b/frontend/src/pages/restore.tsx index 417ca8a..6a7bde8 100644 --- a/frontend/src/pages/restore.tsx +++ b/frontend/src/pages/restore.tsx @@ -2,8 +2,8 @@ import { useState, useEffect, useMemo, useCallback, FC, useRef, RefObject } from import Grid from "@mui/material/Grid"; import Box from "@mui/material/Box"; -import { FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray, FileBrowserHandle } from "chonky"; -import { ChonkyActions, ChonkyFileActionData, FileData } from "chonky"; +import { FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray, FileBrowserHandle } from "@aperturerobotics/chonky"; +import { ChonkyActions, ChonkyFileActionData, FileData } from "@aperturerobotics/chonky"; import { cli, convertFiles } from "../api"; import { Root } from "../api"; @@ -62,7 +62,7 @@ const useRestoreSourceBrowser = (source: RefObject) => { return; } }, - [openFolder, source, folderChain] + [openFolder, source, folderChain], ); const fileActions = useMemo(() => [ChonkyActions.StartDragNDrop, RefreshListAction], []); @@ -113,7 +113,7 @@ const useRestoreTargetBrowser = () => { return; } }, - [files, setFiles] + [files, setFiles], ); const fileActions = useMemo(() => [ChonkyActions.DeleteFiles, AddFileAction, CreateRestoreJobAction], []); diff --git a/frontend/src/pages/tapes.tsx b/frontend/src/pages/tapes.tsx index 1a13697..fd0e9b8 100644 --- a/frontend/src/pages/tapes.tsx +++ b/frontend/src/pages/tapes.tsx @@ -3,8 +3,8 @@ import moment from "moment"; import Grid from "@mui/material/Grid"; import Box from "@mui/material/Box"; -import { FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray, FileBrowserHandle } from "chonky"; -import { ChonkyActions, ChonkyFileActionData, FileData } from "chonky"; +import { FileBrowser, FileNavbar, FileToolbar, FileList, FileContextMenu, FileArray, FileBrowserHandle } from "@aperturerobotics/chonky"; +import { ChonkyActions, ChonkyFileActionData, FileData } from "@aperturerobotics/chonky"; import { cli, Root } from "../api"; import { TapeListRequest, Source, Tape } from "../entity"; @@ -72,7 +72,7 @@ const useTapesSourceBrowser = (source: RefObject) => { return; } }, - [openFolder, source, folderChain] + [openFolder, source, folderChain], ); const fileActions = useMemo(() => [ChonkyActions.DeleteFiles], []); diff --git a/frontend/src/tools.ts b/frontend/src/tools.ts index a163667..55d510e 100644 --- a/frontend/src/tools.ts +++ b/frontend/src/tools.ts @@ -9,7 +9,7 @@ export const hexEncode = (buf: string) => { }; export const formatFilesize = (size: number | bigint): string => - filesize(size, { + filesize(size as any as number, { base: 2, standard: "jedec", }) as string;