libingxiang 2567534a9d
Some checks failed
study-online / Explore-Gitea-Actions (push) Has been cancelled
ci
2025-08-04 16:29:35 +08:00

61 lines
2.0 KiB
YAML

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: |
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/"
sudo rm -rf /yantoo/frontend/*
sudo cp -r dist/* /yantoo/frontend/
echo "Files successfully moved to /yantoo/frontend/"