Skip to content

Commit 6e43b6e

Browse files
author
Your Name
committed
ci
1 parent a161fd7 commit 6e43b6e

File tree

14 files changed

+160
-25
lines changed

14 files changed

+160
-25
lines changed

.github/workflows/build_apk.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Android CI
2+
3+
# 触发器
4+
on:
5+
push:
6+
tags:
7+
- '*'
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-latest
12+
# 设置jdk环境为1.8
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: set up JDK 1.8
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 1.8
19+
20+
# 打包release
21+
- name: Build with Gradle
22+
env:
23+
PASSWORD: ${{ secrets.PASSWORD }}
24+
ALIAS: ${{ secrets.ALIAS }}
25+
run: |
26+
sed -i "1s/xxxxxx/$PASSWORD/" keystore.properties
27+
sed -i "2s/xxxxxx/$PASSWORD/" keystore.properties
28+
sed -i "3s/xxxxxx/$ALIAS/" keystore.properties
29+
bash ./gradlew assembleRelease
30+
#step:上传apk 到action,在右上角查看
31+
# 官方文档 https://help.github.com/cn/actions/automating-your-workflow-with-github-actions/persisting-workflow-data-using-artifacts#uploading-build-and-test-artifacts
32+
- name: Upload APK
33+
uses: actions/upload-artifact@v2
34+
with:
35+
name: app
36+
path: app/build/outputs/apk/release/app-release.apk
37+
# 创建realease
38+
- name: Create Release
39+
id: create_release
40+
uses: actions/create-release@v1
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
with:
44+
tag_name: ${{ github.ref }}
45+
release_name: Release ${{ github.ref }}
46+
draft: false
47+
prerelease: false
48+
# 上传apk到release
49+
- name: Upload Release Asset
50+
id: upload-release-asset
51+
uses: actions/upload-release-asset@v1
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
54+
with:
55+
# This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`.
56+
# See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
57+
upload_url: ${{ steps.create_release.outputs.upload_url }}
58+
asset_path: app/build/outputs/apk/release/app-release.apk
59+
asset_name: App.apk
60+
asset_content_type: application/vnd.android.package-archiv

.idea/compiler.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/gradle.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/jarRepositories.xml

Lines changed: 25 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adbext.jks

2.55 KB
Binary file not shown.

app/build.gradle

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,15 @@
11
plugins {
22
id 'com.android.application'
33
}
4+
// Create a variable called keystorePropertiesFile, and initialize it to your
5+
// keystore.properties file, in the rootProject folder.
6+
def keystorePropertiesFile = rootProject.file("keystore.properties")
47

8+
// Initialize a new Properties() object called keystoreProperties.
9+
def keystoreProperties = new Properties()
10+
11+
// Load your keystore.properties file into the keystoreProperties object.
12+
keystoreProperties.load(new FileInputStream(keystorePropertiesFile))
513
android {
614
namespace 'com.niostack.adbext'
715
compileSdk 33
@@ -12,14 +20,21 @@ android {
1220
targetSdk 33
1321
versionCode 1
1422
versionName "1.0"
15-
1623
vectorDrawables {
1724
useSupportLibrary true
1825
}
1926
}
20-
27+
signingConfigs {
28+
config {
29+
keyAlias keystoreProperties['keyAlias']
30+
keyPassword keystoreProperties['keyPassword']
31+
storeFile file(keystoreProperties['storeFile'])
32+
storePassword keystoreProperties['storePassword']
33+
}
34+
}
2135
buildTypes {
2236
release {
37+
signingConfig signingConfigs.config //配置签名文件
2338
minifyEnabled false
2439
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
2540
}
@@ -29,14 +44,7 @@ android {
2944
targetCompatibility JavaVersion.VERSION_1_8
3045
}
3146

32-
buildFeatures {
33-
compose true
34-
}
3547

36-
packaging {
37-
resources {
38-
}
39-
}
4048
}
4149

4250
dependencies {

app/release/app-release.apk

53.8 KB
Binary file not shown.

app/release/output-metadata.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": 3,
3+
"artifactType": {
4+
"type": "APK",
5+
"kind": "Directory"
6+
},
7+
"applicationId": "com.niostack.adbext",
8+
"variantName": "release",
9+
"elements": [
10+
{
11+
"type": "SINGLE",
12+
"filters": [],
13+
"attributes": [],
14+
"versionCode": 1,
15+
"versionName": "1.0",
16+
"outputFile": "app-release.apk"
17+
}
18+
],
19+
"elementType": "File"
20+
}

0 commit comments

Comments
 (0)