Skip to content

Commit dfa6d31

Browse files
committed
Update release message
Init auto gen changelog
1 parent 89bbbc6 commit dfa6d31

File tree

5 files changed

+731
-43
lines changed

5 files changed

+731
-43
lines changed

.github/release_template.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<div align=center>
2+
3+
[![Release Downloads](https://img.shields.io/github/downloads/chen08209/FlClash/vVERSION/total?style=flat-square&logo=github)](https://img.shields.io/github/downloads/chen08209/FlClash/vVERSION/)
4+
5+
</div>
6+
7+
**Download based on your OS:**
8+
9+
<div align=left>
10+
<table>
11+
<thead align=left>
12+
<tr>
13+
<th>OS</th>
14+
<th>Download</th>
15+
</tr>
16+
</thead>
17+
<tbody align=left>
18+
<tr>
19+
<td>Android</td>
20+
<td>
21+
<a href="https://github.com/chen08209/FlClash/releases/download/vVERSION/FlClash-VERSION-android-arm64-v8a.apk"><img src="https://img.shields.io/badge/APK-ARMv8-168039.svg?logo=android"></a><br>
22+
<a href="https://github.com/chen08209/FlClash/releases/download/vVERSION/FlClash-VERSION-android-armeabi-v7a.apk"><img src="https://img.shields.io/badge/APK-ARMv7-45bf55.svg?logo=android"></a><br>
23+
<a href="https://github.com/chen08209/FlClash/releases/download/vVERSION/FlClash-VERSION-android-x86_64.apk"><img src="https://img.shields.io/badge/APK-x64-96ed89.svg?logo=android"></a>
24+
</td>
25+
</tr>
26+
<tr>
27+
<td>Windows</td>
28+
<td>
29+
<a href="https://github.com/chen08209/FlClash/releases/download/vVERSION/FlClash-VERSION-windows-amd64-setup.exe"><img src="https://img.shields.io/badge/Setup-x64-2d7d9a.svg?logo=windows"></a><br>
30+
<a href="https://github.com/chen08209/FlClash/releases/download/vVERSION/FlClash-VERSION-windows-amd64.zip"><img src="https://img.shields.io/badge/Portable-x64-67b7d1.svg?logo=windows"></a>
31+
</td>
32+
</tr>
33+
<tr>
34+
<td>macOS (v10.15+)</td>
35+
<td>
36+
<a href="https://github.com/chen08209/FlClash/releases/download/vVERSION/FlClash-VERSION-macos-amd64.dmg"><img src="https://img.shields.io/badge/DMG-Universal-ea005e.svg?logo=apple"></a><br>
37+
</td>
38+
</tr>
39+
<tr>
40+
<td>Linux</td>
41+
<td>
42+
<a href="https://github.com/chen08209/FlClash/releases/download/vVERSION/FlClash-VERSION-linux-amd64.AppImage"><img src="https://img.shields.io/badge/AppImage-x64-f84e29.svg?logo=linux"> </a><br>
43+
<a href="https://github.com/chen08209/FlClash/releases/download/vVERSION/FlClash-VERSION-linux-amd64.deb"><img src="https://img.shields.io/badge/DebPackage-x64-FF9966.svg?logo=debian"> </a><br>
44+
<a href="https://github.com/chen08209/FlClash/releases/download/vVERSION/FlClash-VERSION-linux-amd64.deb"><img src="https://img.shields.io/badge/RpmPackage-x64-F1B42F.svg?logo=redhat"> </a>
45+
</td>
46+
</tr>
47+
</tbody>
48+
</table>
49+
50+
51+
</div>
52+
53+
<div dir="ltr">
54+
55+
**List of all changes:** [ChangeLog](https://github.com/chen08209/FlClash/blob/main/CHANGELOG.md)
56+
57+
</div>
Lines changed: 43 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535
install: mingw-w64-x86_64-gcc
3636
update: true
3737

38-
3938
- name: Set Mingw64 Env
4039
if: startsWith(matrix.platform,'windows')
4140
run: |
@@ -105,8 +104,7 @@ jobs:
105104
overwrite: true
106105

107106

108-
upload-release:
109-
if: ${{ !contains(github.ref, '+') }}
107+
upload:
110108
permissions: write-all
111109
needs: [ build ]
112110
runs-on: ubuntu-latest
@@ -123,32 +121,62 @@ jobs:
123121
pattern: artifact-*
124122
merge-multiple: true
125123

126-
- name: Pre Release
124+
- name: Generate release
127125
run: |
128-
pip install gitchangelog pystache mustache markdown
129-
pre=$(curl --silent "https://api.github.com/repos/chen08209/FlClash/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
130-
if [ -z "pre" ]; then
131-
echo "init" > release.md
132-
else
133-
current="${{ github.ref_name }}"
134-
echo -e "\n\n<details markdown=1><summary>All changes from $current to the latest commit:</summary>\n\n" >> release.md
135-
gitchangelog "${pre}.." >> release.md 2>&1 || echo "Error in gitchangelog"
136-
echo -e "\n\n</details>" >> release.md
137-
fi
126+
tags=($(git tag --merged $(git rev-parse HEAD) --sort=-creatordate))
127+
preTag=$(curl --silent "https://api.github.com/repos/chen08209/FlClash/releases/latest" | grep -Po '"tag_name": "\K.*?(?=")' || echo "")
128+
version=$(echo "${{ github.ref_name }}" | sed 's/^v//')
129+
sed "s|VERSION|$version|g" ./.github/release_template.md > release.md
130+
currentTag=""
131+
for ((i = 0; i <= ${#tags[@]}; i++)); do
132+
if (( i < ${#tags[@]} )); then
133+
tag=${tags[$i]}
134+
else
135+
tag=""
136+
fi
137+
if [ -n "$currentTag" ]; then
138+
if [ "$(echo -e "$currentTag\n$preTag" | sort -V | head -n 1)" == "$currentTag" ]; then
139+
break
140+
fi
141+
fi
142+
if [ -n "$currentTag" ]; then
143+
echo "## $currentTag" >> release.md
144+
echo "" >> release.md
145+
if [ -n "$tag" ]; then
146+
git log --pretty=format:"%B" "$tag..$currentTag" | awk 'NF {print "- " $0} !NF {print ""}' >> release.md
147+
else
148+
git log --pretty=format:"%B" "$currentTag" | awk 'NF {print "- " $0} !NF {print ""}' >> release.md
149+
fi
150+
echo "" >> release.md
151+
fi
152+
currentTag=$tag
153+
done
154+
155+
- name: Upload
156+
if: ${{ contains(github.ref, '+') }}
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: artifact
160+
path: ./dist
161+
retention-days: 7
162+
overwrite: true
138163

139164
- name: Release
165+
if: ${{ !contains(github.ref, '+') }}
140166
uses: softprops/action-gh-release@v2
141167
with:
142168
files: ./dist/*
143169
body_path: './release.md'
144170

145171
- name: Create Fdroid Source Dir
172+
if: ${{ !contains(github.ref, '+') }}
146173
run: |
147174
mkdir -p ./tmp
148175
cp ./dist/*android-arm64-v8a* ./tmp/ || true
149176
echo "Files copied successfully"
150177
151178
- name: Push to fdroid repo
179+
if: ${{ !contains(github.ref, '+') }}
152180
uses: cpina/[email protected]
153181
env:
154182
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
@@ -160,31 +188,4 @@ jobs:
160188
user-email: 'github-actions[bot]@users.noreply.github.com'
161189
target-branch: action-pr
162190
commit-message: Update from ${{ github.ref_name }}
163-
target-directory: /tmp/
164-
165-
166-
upload-test:
167-
if: ${{ contains(github.ref, '+') }}
168-
permissions: write-all
169-
needs: [ build ]
170-
runs-on: ubuntu-latest
171-
steps:
172-
- name: Checkout
173-
uses: actions/checkout@v4
174-
with:
175-
fetch-depth: 0
176-
177-
- name: Download
178-
uses: actions/download-artifact@v4
179-
with:
180-
path: ./dist/
181-
pattern: artifact-*
182-
merge-multiple: true
183-
184-
- name: Upload
185-
uses: actions/upload-artifact@v4
186-
with:
187-
name: artifact
188-
path: ./dist
189-
retention-days: 7
190-
overwrite: true
191+
target-directory: /tmp/

0 commit comments

Comments
 (0)