weizhuozhongzhi/.gitea/workflows/run.yml

43 lines
1.1 KiB
YAML

name: run-app
on:
push:
branches:
- main
jobs:
build:
runs-on: host
steps:
- name: Ensure Node.js (install if missing)
run: |
if ! command -v node >/dev/null 2>&1; then
echo "Node.js not found, installing..."
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
else
echo "Node.js already installed: $(node -v)"
fi
- name: Clone repository
run: |
set -e
REPO_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}.git"
echo "Cloning repo from: ${REPO_URL}"
rm -rf repo
git clone "${REPO_URL}" repo
- name: Build project
run: |
set -e
cd repo
yarn install --frozen-lockfile
yarn build
- name: Copy dist to /data/wwwroot/weizhuozhongzhi-ai
run: |
set -e
cd repo
mkdir -p /data/wwwroot/weizhuozhongzhi-ai
rm -rf /data/wwwroot/weizhuozhongzhi-ai/*
cp -r dist/* /data/wwwroot/weizhuozhongzhi-ai/