
All checks were successful
Gitea Actions 自动编译Vite APP / build-and-release (push) Successful in 1m26s
46 lines
1.4 KiB
YAML
46 lines
1.4 KiB
YAML
name: Gitea Actions 自动编译Vite APP
|
||
on:
|
||
push:
|
||
branches:
|
||
- master # 监听哪个分支的哪个动作
|
||
permissions:
|
||
contents: write # 设置权限,可写
|
||
pull-requests: write
|
||
jobs:
|
||
build-and-release: # 其中一个任务的名称,ID
|
||
runs-on: ubuntu-latest # 这个任务运行所需的环境
|
||
steps:
|
||
- name: 初始化环境 ☁️
|
||
run: |
|
||
sed -i "s/ports.ubuntu.com/mirrors.aliyun.com/g" /etc/apt/sources.list
|
||
rm /etc/apt/sources.list.d/*
|
||
apt-get update
|
||
apt-get install -y nodejs npm
|
||
npm config set registry https://registry.npmmirror.com
|
||
# yarn config set registry https://registry.npmmirror.com
|
||
|
||
- name: 获取源码 🛎️
|
||
uses: https://gitea.com/actions/checkout@v4
|
||
|
||
- name: 安装依赖与构建 🔧
|
||
run: |
|
||
npm install
|
||
npm run build
|
||
|
||
- name: 打包 📦
|
||
run: |
|
||
tar -zcvf dist.tar.gz dist
|
||
|
||
- name: 计算哈希 📝
|
||
id: get-hash
|
||
run: |
|
||
echo "::set-output name=hash::$(git rev-parse --short HEAD)"
|
||
|
||
- name: 发布 🚀
|
||
uses: https://gitea.com/actions/gitea-release-action@v1
|
||
with:
|
||
files: dist.tar.gz
|
||
api_key: ${{ secrets.RELEASE_TOKEN }}
|
||
tag_name: ${{ steps.get-hash.outputs.hash }}
|
||
name: ${{ steps.get-hash.outputs.hash }}
|