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, '+') }}
152180153181 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