-
Notifications
You must be signed in to change notification settings - Fork 269
48 lines (41 loc) · 1.39 KB
/
auto-release.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
name: Auto Generate Release
on:
push:
paths:
- 'gfw.pac'
workflow_dispatch:
jobs:
generate-release:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Git
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
- name: Generate Release Name
id: commit_count
run: |
today=$(TZ=Asia/Shanghai date +%Y%m%d)
commit_count=$(TZ=Asia/Shanghai git log --date=local --since="$today 00:00:00" --until="$today 23:59:59" --pretty=format: --name-only | grep -c '^gfw.pac$')
echo "COMMIT_COUNT=$commit_count" >> $GITHUB_ENV
echo "RELEASE_NAME=v$(TZ='Asia/Shanghai' date +%Y%m%d).$commit_count" >> $GITHUB_ENV
echo "COMMIT_MESSAGE=$(git log -1 --pretty=%B)" >> $GITHUB_ENV
- name: Create Tag
id: create_tag
run: |
git tag "${{ env.RELEASE_NAME }}"
git push origin ${{ env.RELEASE_NAME }}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
with:
tag_name: "${{ env.RELEASE_NAME }}"
name: "${{ env.RELEASE_NAME }}"
body: "${{ env.COMMIT_MESSAGE }}"
draft: false
prerelease: false
files: gfw.pac