1- name : Build Release
1+ name : Release
22
33on :
44 workflow_dispatch :
88 required : true
99
1010jobs :
11- BuildRelease :
11+ release :
12+ permissions :
13+ contents : write
1214 runs-on : ubuntu-latest
1315 steps :
14- - name : Checkout Repository
15- uses : actions/checkout@v4
16- with :
17- fetch-depth : 0
18-
19- - name : Checkout submodules
16+ - uses : actions/checkout@v4
17+ - name : Checkout submodules # This is required, don't use submodules flag for actions/checkout instead.
2018 run : git submodule update --init --recursive --force
21-
22- - name : Setup Java
23- uses : actions/setup-java@v4
19+ - uses : actions/setup-java@v4
2420 with :
2521 distribution : " temurin"
2622 java-version : 21
27-
28- - name : Setup Gradle
29- uses : gradle/actions/setup-gradle@v4
30-
31- - name : Setup Go
32- uses : actions/setup-go@v6
23+ - uses : gradle/actions/setup-gradle@v4
24+ - uses : actions/setup-go@v6
3325 with :
3426 go-version : " 1.26"
3527 check-latest : true # Always check for the latest patch release
36-
37- - uses : actions/cache@v4
38- with :
39- path : |
40- ~/.cache/go-build
41- ~/go/pkg/mod
42- key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
43- restore-keys : |
44- ${{ runner.os }}-go-
45-
28+ - name : Update CA
29+ if : github.repository == 'MetaCubeX/ClashMetaForAndroid'
30+ run : |
31+ sudo apt-get update && sudo apt-get install ca-certificates
32+ sudo update-ca-certificates
33+ cp -f /etc/ssl/certs/ca-certificates.crt core/src/foss/golang/clash/component/ca/ca-certificates.crt
34+ - name : Write signing properties
35+ if : github.repository == 'MetaCubeX/ClashMetaForAndroid'
36+ env :
37+ SIGNING_STORE_PASSWORD : ${{ secrets.SIGNING_STORE_PASSWORD }}
38+ SIGNING_KEY_ALIAS : ${{ secrets.SIGNING_KEY_ALIAS }}
39+ SIGNING_KEY_PASSWORD : ${{ secrets.SIGNING_KEY_PASSWORD }}
40+ run : |
41+ touch signing.properties
42+ echo keystore.password="$SIGNING_STORE_PASSWORD" > signing.properties
43+ echo key.alias="$SIGNING_KEY_ALIAS" >> signing.properties
44+ echo key.password="$SIGNING_KEY_PASSWORD" >> signing.properties
4645 - name : Convert and set version env
4746 id : process-version
4847 run : |
4948 VERSION_TAG=${{ inputs.release-tag }}
5049 VERSION_TAG=${VERSION_TAG#v} # remove the 'v' prefix
5150 IFS='.' read -ra VERSION_PARTS <<< "$VERSION_TAG" # split into array
5251 VERSION_CODE=$(printf "%1d%02d%03d" "${VERSION_PARTS[0]}" "${VERSION_PARTS[1]}" "${VERSION_PARTS[2]}")
53-
52+
5453 echo "versonName=$VERSION_TAG" >> $GITHUB_OUTPUT # "1.2.3"
5554 echo "versonCode=$VERSION_CODE" >> $GITHUB_OUTPUT # "102003"
56-
5755 # Re-write version in build.gradle.kts
5856 - name : Re-write version
5957 uses : Devofure/advance-android-version-actions@v1.5
6058 with :
6159 gradlePath : build.gradle.kts
6260 versionCode : ${{ steps.process-version.outputs.versonCode }}
6361 versionName : ${{ steps.process-version.outputs.versonName }}
64-
6562 # If any change found, commit it and push
6663 - name : Commit and push if changes
6764 run : |
@@ -77,52 +74,10 @@ jobs:
7774 git tag "v$newVersionName"
7875 git push --follow-tags
7976 fi
80-
81- - name : Update CA
82- run : |
83- sudo apt-get update && sudo apt-get install ca-certificates
84- sudo update-ca-certificates
85- cp -f /etc/ssl/certs/ca-certificates.crt core/src/foss/golang/clash/component/ca/ca-certificates.crt
86-
87- - name : Signing properties
88- env :
89- SIGNING_STORE_PASSWORD : ${{ secrets.SIGNING_STORE_PASSWORD }}
90- SIGNING_KEY_ALIAS : ${{ secrets.SIGNING_KEY_ALIAS }}
91- SIGNING_KEY_PASSWORD : ${{ secrets.SIGNING_KEY_PASSWORD }}
92- run : |
93- touch signing.properties
94- echo keystore.password="$SIGNING_STORE_PASSWORD" > signing.properties
95- echo key.alias="$SIGNING_KEY_ALIAS" >> signing.properties
96- echo key.password="$SIGNING_KEY_PASSWORD" >> signing.properties
97-
98- echo "cat signing.properties"
99- cat signing.properties
100-
101- - name : Release Build
102- if : success()
103- run : ./gradlew --no-daemon app:assembleMetaRelease
104-
105- - name : Tag Repo
106- uses : richardsimko/update-tag@v1
107- with :
108- tag_name : ${{ inputs.release-tag }}
77+ - name : Build
78+ run : ./gradlew app:assembleMetaRelease
79+ - name : Create release
10980 env :
11081 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
111-
112- - name : Upload Release
113- uses : softprops/action-gh-release@v1
114- if : ${{ success() }}
115- with :
116- tag_name : ${{ inputs.release-tag }}
117- files : app/build/outputs/apk/meta/release/*
118- generate_release_notes : true
119-
120- - name : Release Changelog Builder
121- uses : mikepenz/release-changelog-builder-action@v4.1.1
122- with :
123- configurationJson : |
124- {
125- "ignore_labels": [
126- "Update"
127- ],
128- }
82+ run : |
83+ gh release create ${{ inputs.release-tag }} "./app/build/outputs/apk/alpha/release/"*.apk --prerelease --generate-notes
0 commit comments