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

Commit 529268a

Browse files
Added: Automatically attach debug APKs when a release is created
1 parent 4d0a1b0 commit 529268a

File tree

2 files changed

+42
-0
lines changed

2 files changed

+42
-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-float-$RELEASE_TAG-debug.apk
32+
$RELEASE_TAG

app/build.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,20 @@ android {
3131
zipAlignEnabled true
3232
}
3333
}
34+
3435
compileOptions {
3536
sourceCompatibility JavaVersion.VERSION_1_8
3637
targetCompatibility JavaVersion.VERSION_1_8
3738
}
39+
40+
applicationVariants.all { variant ->
41+
variant.outputs.all { output ->
42+
if (variant.buildType.name == "debug") {
43+
def releaseTag = System.getenv("RELEASE_TAG")
44+
outputFileName = new File("termux-float" + (releaseTag ? "-" + releaseTag : "") + "-debug.apk")
45+
}
46+
}
47+
}
3848
}
3949

4050
dependencies {

0 commit comments

Comments
 (0)