diff --git a/.gitea/workflows/run.yml b/.gitea/workflows/run.yml index 7138160..32cec23 100644 --- a/.gitea/workflows/run.yml +++ b/.gitea/workflows/run.yml @@ -9,24 +9,36 @@ jobs: build: runs-on: host steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Setup Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - cache: 'yarn' - - - name: Install dependencies + - name: Ensure Node.js (install if missing) run: | - corepack enable - yarn install --frozen-lockfile + 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: yarn build - - - name: copy dist /data/wwwroot/weizhuozhongzhi-ai run: | + set -e + cd repo + corepack enable + 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 - cp -r ./dist/* /data/wwwroot/weizhuozhongzhi-ai/ \ No newline at end of file + rm -rf /data/wwwroot/weizhuozhongzhi-ai/* + cp -r dist/* /data/wwwroot/weizhuozhongzhi-ai/ \ No newline at end of file