feat: make things to latest

This commit is contained in:
ckt1031 2023-09-14 11:52:28 +08:00
parent 1e13d9447c
commit 41f5e1351a
13 changed files with 57 additions and 1947 deletions

View File

@ -18,7 +18,7 @@ jobs:
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Save version info
run: |
@ -28,20 +28,20 @@ jobs:
run: |
python ./i18n/translate.py --repository_path . --json_file_path ./i18n/en.json
- name: Log in to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: |
ckt1031/one-api-en
- name: Build and push Docker images
uses: docker/build-push-action@v3
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: true

View File

@ -18,20 +18,20 @@ jobs:
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Save version info
run: |
git describe --tags > VERSION
- name: Log in to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v2
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
@ -39,14 +39,14 @@ jobs:
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: |
ckt1031/one-api
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@v3
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
push: true

View File

@ -19,26 +19,26 @@ jobs:
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
- name: Save version info
run: |
git describe --tags > VERSION
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Log in to Docker Hub
uses: docker/login-action@v2
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to the Container registry
uses: docker/login-action@v2
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: ghcr.io
username: ${{ github.actor }}
@ -46,14 +46,14 @@ jobs:
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
with:
images: |
ckt1031/one-api
ghcr.io/${{ github.repository }}
- name: Build and push Docker images
uses: docker/build-push-action@v3
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
with:
context: .
platforms: linux/amd64,linux/arm64

View File

@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
@ -20,23 +20,19 @@ jobs:
run: |
python ./i18n/translate.py --repository_path . --json_file_path ./i18n/en.json
- uses: pnpm/action-setup@v2
- uses: oven-sh/setup-bun@a1800f471a0bc25cddac36bb13e6f436ddf341d7 # v1
with:
version: 8
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 16
bun-version: latest
- name: Build Frontend
env:
CI: ""
run: |
cd web
pnpm install
REACT_APP_VERSION=$(git describe --tags) npm run build
bun install
REACT_APP_VERSION=$(git describe --tags) bun run build
cd ..
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ">=1.18.0"
- name: Build Backend (amd64)
@ -51,7 +47,7 @@ jobs:
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api-arm64-en
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |

View File

@ -5,35 +5,31 @@ permissions:
on:
push:
tags:
- '*'
- '!*-alpha*'
- "*"
- "!*-alpha*"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
- uses: oven-sh/setup-bun@a1800f471a0bc25cddac36bb13e6f436ddf341d7 # v1
with:
version: 8
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 16
bun-version: latest
- name: Build Frontend
env:
CI: ""
run: |
cd web
pnpm install
REACT_APP_VERSION=$(git describe --tags) npm run build
bun install
REACT_APP_VERSION=$(git describe --tags) bun run build
cd ..
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: '>=1.18.0'
go-version: ">=1.18.0"
- name: Build Backend (amd64)
run: |
go mod download
@ -46,7 +42,7 @@ jobs:
CC=aarch64-linux-gnu-gcc CGO_ENABLED=1 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)' -extldflags '-static'" -o one-api-arm64
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |

View File

@ -12,26 +12,22 @@ jobs:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
- uses: oven-sh/setup-bun@a1800f471a0bc25cddac36bb13e6f436ddf341d7 # v1
with:
version: 8
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 16
bun-version: latest
- name: Build Frontend
env:
CI: ""
run: |
cd web
pnpm install
REACT_APP_VERSION=$(git describe --tags) npm run build
bun install
REACT_APP_VERSION=$(git describe --tags) bun run build
cd ..
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ">=1.18.0"
- name: Build Backend
@ -39,7 +35,7 @@ jobs:
go mod download
go build -ldflags "-X 'one-api/common.Version=$(git describe --tags)'" -o one-api-macos
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: one-api-macos

View File

@ -15,26 +15,22 @@ jobs:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
fetch-depth: 0
- uses: pnpm/action-setup@v2
- uses: oven-sh/setup-bun@a1800f471a0bc25cddac36bb13e6f436ddf341d7 # v1
with:
version: 8
- uses: actions/setup-node@v3
with:
cache: pnpm
node-version: 16
bun-version: latest
- name: Build Frontend
env:
CI: ""
run: |
cd web
pnpm install
REACT_APP_VERSION=$(git describe --tags) npm run build
bun install
REACT_APP_VERSION=$(git describe --tags) bun run build
cd ..
- name: Set up Go
uses: actions/setup-go@v3
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version: ">=1.18.0"
- name: Build Backend
@ -42,7 +38,7 @@ jobs:
go mod download
go build -ldflags "-s -w -X 'one-api/common.Version=$(git describe --tags)'" -o one-api.exe
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: one-api.exe

View File

@ -4,15 +4,14 @@ WORKDIR /app
COPY . .
RUN chmod +x ./translate-en.sh && ./translate-en.sh
FROM node:18 as builder
FROM oven/bun:latest as builder
WORKDIR /build
COPY ./web/package*.json ./
RUN npm i -g pnpm
RUN pnpm i
COPY ./web/package*.json ./web/bun.lockb ./web/.npmrc ./
RUN bun i
COPY --from=translator ./app/web .
COPY ./VERSION .
RUN REACT_APP_VERSION=$(cat VERSION) npm run build
RUN REACT_APP_VERSION=$(cat VERSION) bun run build
FROM golang AS builder2

View File

@ -4,10 +4,10 @@
```shell
# Runs the app in the development mode
npm start
bun start
# Builds the app for production to the `build` folder
npm run build
bun run build
```
If you want to change the default server, please set `REACT_APP_SERVER` environment variables before build,

BIN
web/bun.lockb Executable file

Binary file not shown.

View File

@ -6,22 +6,18 @@
"@vitejs/plugin-react-swc": "^3.3.2",
"axios": "^1.5.0",
"history": "^5.3.0",
"marked": "^8.0.1",
"marked": "^9.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-dropzone": "^14.2.3",
"react-router-dom": "^6.15.0",
"react-router-dom": "^6.16.0",
"react-toastify": "^9.1.3",
"react-turnstile": "^1.1.1",
"semantic-ui-css": "^2.5.0",
"semantic-ui-react": "^2.1.4",
"sharp": "^0.32.5",
"svgo": "^3.0.2",
"vite": "^4.4.9",
"vite-plugin-env-compatible": "^1.1.1",
"vite-plugin-html": "^3.2.0",
"vite-plugin-image-optimizer": "^1.1.7",
"vite-plugin-sri": "^0.0.2"
"vite-plugin-html": "^3.2.0"
},
"scripts": {
"start": "vite preview",

File diff suppressed because it is too large Load Diff

View File

@ -2,14 +2,10 @@ import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import envCompatible from 'vite-plugin-env-compatible'
import { createHtmlPlugin } from 'vite-plugin-html'
import { ViteImageOptimizer } from 'vite-plugin-image-optimizer';
//import sri from 'vite-plugin-sri';
export default defineConfig({
plugins: [
//sri(),
react(),
ViteImageOptimizer(),
createHtmlPlugin(),
envCompatible({
prefix: "REACT_APP_",