-
Notifications
You must be signed in to change notification settings - Fork 7
60 lines (51 loc) · 2.05 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: main
on:
# 每当 push 到 main 分支时触发部署
push:
tags:
- "v*.*.*"
# 手动触发部署
workflow_dispatch:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: 🏡拉取代码
uses: actions/checkout@v3
with:
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
fetch-depth: 0
- name: 💾缓存 Composer 依赖
uses: actions/cache@v3
with:
path: /tmp/composer-cache
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- name: ✍️提取标签名称
id: github_ref
run: tag=$(echo "${{ github.ref }}" | cut -d '/' -f 3)
echo "tag=$tag" >> $GITHUB_STATE
- name: 🛠️安装依赖
uses: php-actions/composer@v6
with:
php_version: "8.1"
version: 2
- name: ❌删除非必要文件
run: |
rm -rf .gitignore .github .git DOCKER_ENV docker_tag output.log composer.json composer.lock script lock.txt upload.md test.env think
- name: 📦压缩为zip
run: zip -r LoveCards-v2.2.1.zip ./ # 记得修改
- name: 🎅创建发布并上传压缩包
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
tag_name: ${{ steps.github_ref.outputs.tag }}
name: 2.2.1[16] # 记得修改
body_path: RELEASE.txt
draft: false
prerelease: true
files: | # 记得修改
LoveCards-v2.2.1.zip
LICENSE
env:
# @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}