forked from MarSeventh/CloudFlare-ImgBed
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (48 loc) · 1.72 KB
/
webpack.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
name: Create Release with Zip
on:
push:
branches:
- main
jobs:
create-release:
runs-on: ubuntu-latest
steps:
# 检出当前仓库的代码
- uses: actions/checkout@v4
# 获取提交信息和当前日期
- name: Get Commit Info
id: get_commit_info
run: |
echo "commit_sha=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "commit_message=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
echo "release_date=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
# 将当前目录下的所有文件打包为 zip 文件
- name: Zip repository files
run: |
zip -r release-v1.0.${{ github.run_number }}.zip ./*
# 创建 Release
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v1.0.${{ github.run_number }} # 自动递增版本号
release_name: "Release v1.0.${{ github.run_number }} - ${{ env.release_date }}"
body: |
### Release Notes
- **Commit SHA**: ${{ env.commit_sha }}
- **Commit Message**: ${{ env.commit_message }}
- **Release Date**: ${{ env.release_date }}
draft: false
prerelease: false
# 上传压缩文件到 Release
- name: Upload Release Assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: release-v1.0.${{ github.run_number }}.zip # 上传压缩文件
asset_name: release-v1.0.${{ github.run_number }}.zip # 上传文件的名称
asset_content_type: application/zip