libingxiang 786f6889ef
Some checks failed
study-online / Explore-Gitea-Actions (push) Failing after 5s
ci
2025-08-04 16:54:14 +08:00

72 lines
2.3 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
- name: Setup environment
run: |
echo "Setting up environment..."
node --version
npm --version
# 设置多个可能解决 crypto 问题的环境变量
export NODE_OPTIONS="--no-warnings"
export VITE_CJS_IGNORE_WARNING=true
export NODE_NO_WARNINGS=1
# 安装依赖
- name: Install dependencies
run: |
echo "Installing dependencies..."
# 使用 --legacy-peer-deps 避免依赖冲突
npm install --legacy-peer-deps
# 构建项目
- name: Build project
run: |
echo "Building project..."
# 设置环境变量
export NODE_OPTIONS="--no-warnings"
export VITE_CJS_IGNORE_WARNING=true
# 执行构建
npm run build
# 移动构建产物
- 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 mkdir -p /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/"