frontend-js-auto-build-temp.../.github/workflows/build.yml
Mars160 c856a819d4
All checks were successful
Gitea Actions 自动编译Vite APP / build-and-release (push) Successful in 1m26s
first commit
2024-11-05 01:32:27 +08:00

46 lines
1.4 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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 }}