这是indexloc提供的服务,不要输入任何密码
Skip to content

Commit 705361e

Browse files
Added: Automatically attach debug APKs when a release is created
1 parent d0e8805 commit 705361e

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Attach Debug APKs To Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
env:
12+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
steps:
14+
- name: Set tag
15+
id: vars
16+
run: echo ::set-output name=tag::${GITHUB_REF/refs\/tags\//}
17+
- name: Clone repository
18+
uses: actions/checkout@v2
19+
with:
20+
ref: ${{ env.GITHUB_REF }}
21+
- name: Build
22+
env:
23+
RELEASE_TAG: ${{ steps.vars.outputs.tag }}
24+
run: ./gradlew assembleDebug
25+
- name: Attach debug APKs to release
26+
env:
27+
RELEASE_TAG: ${{ steps.vars.outputs.tag }}
28+
run: >-
29+
hub release edit
30+
-m ""
31+
-a ./app/build/outputs/apk/debug/termux-tasker-$RELEASE_TAG-debug.apk
32+
$RELEASE_TAG

.github/workflows/debug_build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ jobs:
1212
run: |
1313
./gradlew assembleDebug
1414
- name: Store generated APK file
15-
uses: actions/upload-artifact@v1
15+
uses: actions/upload-artifact@v2
1616
with:
1717
name: termux-tasker
18-
path: ./app/build/outputs/apk/debug/app-debug.apk
18+
path: |
19+
./app/build/outputs/apk/debug/termux-tasker-debug.apk
20+
./app/build/outputs/apk/debug/output-metadata.json

app/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@ android {
4141
sourceCompatibility JavaVersion.VERSION_1_8
4242
targetCompatibility JavaVersion.VERSION_1_8
4343
}
44+
45+
applicationVariants.all { variant ->
46+
variant.outputs.all { output ->
47+
if (variant.buildType.name == "debug") {
48+
def releaseTag = System.getenv("RELEASE_TAG")
49+
outputFileName = new File("termux-tasker" + (releaseTag ? "-" + releaseTag : "") + "-debug.apk")
50+
}
51+
}
52+
}
4453
}
4554

4655
dependencies {

0 commit comments

Comments
 (0)