name: study-online run-name: ${{ gitea.actor }} is testing out Gitea Actions 🚀 on: push: branches: - master - "release**" env: BUILD: staging jobs: Explore-Gitea-Actions: runs-on: stream9 steps: - run: echo "🎉 The job was automatically triggered by a ${{ gitea.event_name }} event." - run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by Gitea!" - run: echo "🔎 The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}." - run: echo "Gitea job id ${{ gitea.run_id }}." - name: Check out repository code uses: https://gitea.yantootech.com/neil/checkout@v4 with: fetch-depth: 1 - run: echo "💡 The ${{ gitea.repository }} repository has been cloned to the runner." - run: echo "🖥️ The workflow is now ready to test your code on the runner." # 使用系统已安装的 Node.js v16.15.0 - name: Use system Node.js v16.15.0 run: | echo "Using system Node.js" node --version npm --version # 检查并安装依赖(如果需要) - name: Install dependencies if needed run: | if [ ! -d "node_modules" ]; then echo "node_modules not found, installing dependencies..." npm install else echo "node_modules already exists, skipping installation" fi # 构建项目 - name: Build project run: | export NODE_OPTIONS="--openssl-legacy-provider" npm run build # 将 dist 目录移动到目标位置 - name: Move dist folder to target directory run: | if [ ! -d "dist" ]; then echo "Error: dist directory not found" ls -la exit 1 fi echo "Dist directory found, moving to /yantoo/frontend/study-online/" sudo rm -rf /yantoo/frontend/study-online/* sudo cp -r dist/* /yantoo/frontend/study-online/ echo "Files successfully moved to /yantoo/frontend/study-online/"