57 lines
1.7 KiB
YAML
57 lines
1.7 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
|
|
# 确保 Node.js 在 PATH 中
|
|
export PATH=$(dirname $(which node)):$PATH
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Build project
|
|
run: npm run build
|
|
|
|
- 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
|
|
sudo mv frontend-dist.zip /yantoo/frontend/
|
|
|
|
- name: Extract package in target directory
|
|
run: |
|
|
cd /yantoo/frontend/
|
|
sudo unzip -o frontend-dist.zip
|
|
sudo rm frontend-dist.zip
|