63 lines
1.8 KiB
YAML
63 lines
1.8 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 Node.js
|
|
uses: actions/setup-node@v3
|
|
timeout-minutes: 5
|
|
with:
|
|
node-version: '23.5.0'
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
timeout 300 npm install || {
|
|
echo "npm install failed or timed out"
|
|
exit 1
|
|
}
|
|
|
|
- name: Build project
|
|
run: |
|
|
timeout 300 npm run build || {
|
|
echo "Build failed or timed out"
|
|
exit 1
|
|
}
|
|
|
|
- name: Package dist folder
|
|
run: |
|
|
if [ ! -d "dist" ]; then
|
|
echo "Error: dist directory not found"
|
|
ls -la
|
|
exit 1
|
|
fi
|
|
zip -r frontend-dist.zip dist
|
|
mv frontend-dist.zip /yantoo/frontend/
|
|
|
|
- name: Extract package in target directory
|
|
run: |
|
|
cd /yantoo/frontend/
|
|
unzip -o frontend-dist.zip
|
|
rm frontend-dist.zip
|