Skip to content

Commit 7870600

Browse files
Automatically attach debug APKs when a release is created
1 parent 67a24bd commit 7870600

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
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-widget-$RELEASE_TAG-debug.apk
32+
$RELEASE_TAG

app/build.gradle

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ android {
3535
sourceCompatibility JavaVersion.VERSION_1_8
3636
targetCompatibility JavaVersion.VERSION_1_8
3737
}
38+
39+
applicationVariants.all { variant ->
40+
variant.outputs.all { output ->
41+
if (variant.buildType.name == "debug") {
42+
def releaseTag = System.getenv("RELEASE_TAG")
43+
outputFileName = new File("termux-widget" + (releaseTag ? "-" + releaseTag : "") + "-debug.apk")
44+
}
45+
}
46+
}
3847
}
3948

4049
task versionName {

0 commit comments

Comments
 (0)