44 workflow_dispatch :
55 inputs :
66 release_tag :
7+ description : ' Release Tag (Optional)'
78 required : false
89 type : string
10+ build_type :
11+ description : ' Build Type'
12+ required : true
13+ default : ' debug'
14+ type : choice
15+ options :
16+ - debug
17+ - release
918 push :
1019 branches :
1120 - master
1726 permissions :
1827 contents : write
1928
29+ env :
30+ BUILD_TYPE : ${{ github.event.inputs.build_type == 'release' && 'release' || 'debug' }}
31+
2032 steps :
2133 - name : Checkout code
22- uses : actions/checkout@v7
34+ uses : actions/checkout@v4
2335 with :
2436 submodules : ' recursive'
2537 fetch-depth : ' 0'
@@ -90,18 +102,28 @@ jobs:
90102 fileName : " android_keystore.jks"
91103 encodedString : ${{ secrets.APP_KEYSTORE_BASE64 }}
92104
93- - name : Build APK
105+ - name : Build APK (${{ env.BUILD_TYPE }})
94106 run : |
95107 cd ${{ github.workspace }}/V2rayNG
96108 echo "sdk.dir=${ANDROID_HOME}" > local.properties
97109 chmod 755 gradlew
98- ./gradlew assembleRelease --console=plain -Pandroid.injected.signing.store.file=${{ steps.android_keystore.outputs.filePath }} -Pandroid.injected.signing.store.password=${{ secrets.APP_KEYSTORE_PASSWORD }} -Pandroid.injected.signing.key.alias=${{ secrets.APP_KEYSTORE_ALIAS }} -Pandroid.injected.signing.key.password=${{ secrets.APP_KEY_PASSWORD }}
99-
110+
111+ if [ "${{ env.BUILD_TYPE }}" == "debug" ]; then
112+ echo "Starting DEBUG build process..."
113+ ./gradlew assembleDebug --console=plain
114+ else
115+ echo "Starting RELEASE build process..."
116+ ./gradlew assembleRelease --console=plain \
117+ -Pandroid.injected.signing.store.file=${{ steps.android_keystore.outputs.filePath }} \
118+ -Pandroid.injected.signing.store.password=${{ secrets.APP_KEYSTORE_PASSWORD }} \
119+ -Pandroid.injected.signing.key.alias=${{ secrets.APP_KEYSTORE_ALIAS }} \
120+ -Pandroid.injected.signing.key.password=${{ secrets.APP_KEY_PASSWORD }}
121+ fi
100122 - name : Sign APKs with v1, v2, and v3
101123 run : |
102124 BUILD_TOOLS_DIR="$ANDROID_HOME/build-tools/37.0.0"
103125
104- for apk in ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/release /*.apk; do
126+ for apk in ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/${{ env.BUILD_TYPE }} /*.apk; do
105127 if [ -f "$apk" ]; then
106128 echo "Signing $apk with v1, v2, and v3 schemes..."
107129 $BUILD_TOOLS_DIR/apksigner sign \
@@ -123,29 +145,29 @@ jobs:
123145 uses : actions/upload-artifact@v4
124146 if : ${{ success() }}
125147 with :
126- name : arm64-v8a
127- path : ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/release /*arm64-v8a*.apk
148+ name : arm64-v8a-${{ env.BUILD_TYPE }}
149+ path : ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/${{ env.BUILD_TYPE }} /*arm64-v8a*.apk
128150
129151 - name : Upload armeabi-v7a APK
130152 uses : actions/upload-artifact@v4
131153 if : ${{ success() }}
132154 with :
133- name : armeabi-v7a
134- path : ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/release /*armeabi-v7a*.apk
155+ name : armeabi-v7a-${{ env.BUILD_TYPE }}
156+ path : ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/${{ env.BUILD_TYPE }} /*armeabi-v7a*.apk
135157
136158 - name : Upload x86 APK
137159 uses : actions/upload-artifact@v4
138160 if : ${{ success() }}
139161 with :
140- name : x86-apk
141- path : ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/release /*x86*.apk
162+ name : x86-apk-${{ env.BUILD_TYPE }}
163+ path : ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/${{ env.BUILD_TYPE }} /*x86*.apk
142164
143165 - name : Upload to release
144166 uses : svenstaro/upload-release-action@v2
145167 if : github.event.inputs.release_tag != ''
146168 with :
147169 repo_token : ${{ secrets.GITHUB_TOKEN }}
148- file : ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/release /*.apk
170+ file : ${{ github.workspace }}/V2rayNG/app/build/outputs/apk/${{ env.BUILD_TYPE }} /*.apk
149171 tag : ${{ github.event.inputs.release_tag }}
150172 file_glob : true
151173 prerelease : true
0 commit comments