ci: add manual workflow for syncing www assets

This commit is contained in:
line-6000
2026-06-16 18:10:33 +08:00
parent 3ab3659fe4
commit 55cc6a9c61
+16 -6
View File
@@ -23,8 +23,7 @@ jobs:
env: env:
FRONTEND_REPOSITORY: ${{ vars.WWW_FRONTEND_REPOSITORY }} FRONTEND_REPOSITORY: ${{ vars.WWW_FRONTEND_REPOSITORY }}
FRONTEND_REF: ${{ vars.WWW_FRONTEND_REF }} FRONTEND_REF: ${{ vars.WWW_FRONTEND_REF }}
FRONTEND_BUILD_DIR: ${{ vars.WWW_FRONTEND_BUILD_DIR || 'dist' }} FRONTEND_BUILD_DIR: ${{ vars.WWW_FRONTEND_BUILD_DIR }}
FRONTEND_DIR: epusdt-admin-web
FRONTEND_TOKEN: ${{ secrets.WWW_FRONTEND_TOKEN }} FRONTEND_TOKEN: ${{ secrets.WWW_FRONTEND_TOKEN }}
WWW_TARGET_DIR: src/www WWW_TARGET_DIR: src/www
@@ -38,7 +37,15 @@ jobs:
- name: Validate Configuration - name: Validate Configuration
run: | run: |
if [[ -z "$FRONTEND_REPOSITORY" ]]; then if [[ -z "$FRONTEND_REPOSITORY" ]]; then
echo "Frontend repository is empty" echo "Set repository variable WWW_FRONTEND_REPOSITORY, for example owner/repo"
exit 1
fi
if [[ -z "$FRONTEND_REF" ]]; then
echo "Set repository variable WWW_FRONTEND_REF, for example main"
exit 1
fi
if [[ -z "$FRONTEND_BUILD_DIR" ]]; then
echo "Set repository variable WWW_FRONTEND_BUILD_DIR, for example dist"
exit 1 exit 1
fi fi
if [[ -z "$FRONTEND_TOKEN" ]]; then if [[ -z "$FRONTEND_TOKEN" ]]; then
@@ -48,7 +55,8 @@ jobs:
- name: Clone Frontend - name: Clone Frontend
run: | run: |
frontend_path="$RUNNER_TEMP/$FRONTEND_DIR" frontend_name="${FRONTEND_REPOSITORY##*/}"
frontend_path="$RUNNER_TEMP/$frontend_name"
git clone \ git clone \
--depth=1 \ --depth=1 \
--branch "$FRONTEND_REF" \ --branch "$FRONTEND_REF" \
@@ -60,13 +68,15 @@ jobs:
- name: Build Frontend - name: Build Frontend
run: | run: |
cd "$RUNNER_TEMP/$FRONTEND_DIR" frontend_name="${FRONTEND_REPOSITORY##*/}"
cd "$RUNNER_TEMP/$frontend_name"
bun install bun install
bun run build bun run build
- name: Replace src/www - name: Replace src/www
run: | run: |
cd "$RUNNER_TEMP/$FRONTEND_DIR" frontend_name="${FRONTEND_REPOSITORY##*/}"
cd "$RUNNER_TEMP/$frontend_name"
if [[ ! -d "$FRONTEND_BUILD_DIR" ]]; then if [[ ! -d "$FRONTEND_BUILD_DIR" ]]; then
echo "Frontend build output does not exist: $FRONTEND_BUILD_DIR" echo "Frontend build output does not exist: $FRONTEND_BUILD_DIR"
exit 1 exit 1