Skip to content

Commit b2995e6

Browse files
committed
useless build-step removed.
1 parent f153051 commit b2995e6

File tree

4 files changed

+62
-54
lines changed

4 files changed

+62
-54
lines changed

.github/workflows/gradle.yml

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,54 @@
1-
name: Gradle
2-
1+
name: CI
32
on:
43
push:
54
branches: [ master ]
65
paths-ignore:
76
- '**/README.md'
87
- '**/.gitignore'
98
- '.run/**'
10-
pull_request:
11-
branches: [ master ]
12-
paths-ignore:
13-
- '**/README.md'
14-
- '**/.gitignore'
15-
- '.run/**'
9+
tags:
10+
- "[0-9]+.[0-9]+.[0-9]+"
1611

1712
jobs:
1813
build:
19-
name: 🎉 Build
14+
name: Build Plugin Package
2015
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
2119
steps:
2220

2321
# Testing the plugin source requires checking out into `buildSrc`.
2422
- name: 🚚 Get latest code
2523
uses: actions/checkout@v4
2624

2725
# https://github.com/actions/setup-java
28-
- name: Set up AWS Corretto JDK 17
26+
- name: Setup JDK
2927
uses: actions/setup-java@v4
3028
with:
29+
architecture: x64
3130
distribution: corretto
3231
java-version: '17'
33-
architecture: x64
3432

35-
- name: 🔢 Configure build
36-
shell: bash
37-
env:
38-
JAVA_KEYSTORE_DEBUG: ${{ secrets.JAVA_KEYSTORE_DEBUG }}
39-
JAVA_KEYSTORE_UPLOAD: ${{ secrets.JAVA_KEYSTORE_UPLOAD }}
40-
JAVA_KEYSTORE_PROPERTIES: ${{ secrets.JAVA_KEYSTORE_PROPERTIES }}
41-
AGC_API_CONFIG: ${{ secrets.AGC_API_CONFIG }}
42-
AGC_APP_RELEASE_CONFIG: ${{ secrets.AGC_APP_RELEASE_CONFIG }}
43-
AGC_APP_DEBUG_CONFIG: ${{ secrets.AGC_APP_DEBUG_CONFIG }}
44-
run: |
45-
chmod +x ./gradlew
46-
mkdir ~/.android
47-
mkdir $GITHUB_WORKSPACE/distribution
48-
mkdir -p $GITHUB_WORKSPACE/mobile/src/huaweiDebug
49-
mkdir -p $GITHUB_WORKSPACE/mobile/src/huaweiRelease
50-
echo $JAVA_KEYSTORE_DEBUG > ~/.android/debug.keystore
51-
echo $JAVA_KEYSTORE_UPLOAD > ~/.android/upload.keystore
52-
echo $JAVA_KEYSTORE_PROPERTIES > $GITHUB_WORKSPACE/keystore.properties
53-
echo $AGC_API_CONFIG > $GITHUB_WORKSPACE/distribution/agc-apiclient.json
54-
echo $AGC_APP_DEBUG_CONFIG > $GITHUB_WORKSPACE/mobile/src/huaweiDebug/agconnect-services.json
55-
echo $AGC_APP_RELEASE_CONFIG > $GITHUB_WORKSPACE/mobile/src/huaweiRelease/agconnect-services.json
33+
- name: Setup Gradle
34+
uses: gradle/actions/setup-gradle@v4
35+
with:
36+
gradle-version: '9.0.0'
37+
build-scan-terms-of-use-url: "https://gradle.com/terms-of-service"
38+
build-scan-terms-of-use-agree: "yes"
39+
build-scan-publish: false
5640

57-
- name: Build with Gradle
58-
env:
59-
AGC_PACKAGE_ID: ${{ secrets.AGC_PACKAGE_ID }}
41+
- name: Gradle Build
6042
run: |
61-
./gradlew :build
43+
mkdir build
44+
gradle :build :publish --no-daemon
6245
cd ./build/libs
6346
ls -la | grep jar
6447
6548
- name: 📦 Retain Artifact (JAR)
6649
id: retain-plugin-jar
6750
uses: actions/upload-artifact@v4
6851
with:
69-
name: buildSrc
52+
name: agconnect-publishing-gradle-plugin
7053
path: ./build/libs/*.jar
7154
retention-days: 14

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ buildscript {
3535
maven { url 'https://jitpack.io' }
3636
}
3737
dependencies {
38-
classpath "com.android.tools.build:gradle:8.11.0"
39-
classpath "com.huawei.agconnect:agcp:1.9.3.300"
38+
classpath "com.android.tools.build:gradle:8.11.1"
39+
classpath "com.huawei.agconnect:agcp:1.9.3.302"
4040
classpath "io.syslogic:agconnect-publishing-gradle-plugin:1.4.1"
4141
}
4242
}
@@ -73,13 +73,20 @@ plugins {
7373
````groovy
7474
/** Huawei AppGallery Connect: agc-apiclient.json */
7575
def json_agc = "distribution${File.separator}agconnect_apiclient.json"
76-
if (rootProject.file(json_agc).exists()) {
77-
agcPublishing {
78-
configFile = rootProject.file(json_agc).absolutePath
79-
releaseType = 1
80-
verbose = false
81-
logHttp = true
82-
}
76+
77+
agcPublishing {
78+
configFile = rootProject.file(json_agc).absolutePath
79+
releaseType = 1
80+
verbose = false
81+
logHttp = true
82+
}
83+
````
84+
85+
````kotlin
86+
configure<PublishingExtensionImpl> {
87+
configFile = rootProject.file(json_agc).absolutePath
88+
verbose = false
89+
logHttp = true
8390
}
8491
````
8592

build.gradle.kts

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ gradlePlugin {
4343
}
4444
}
4545

46-
4746
tasks.withType<Test>().configureEach {
4847
useJUnitPlatform()
4948
}
@@ -62,7 +61,7 @@ val implCls: Configuration by configurations.creating {
6261
val javadocs by tasks.registering(Javadoc::class) {
6362
title = "${project.ext.get("plugin_display_name")} ${project.ext.get("plugin_version")} API"
6463
classpath += implCls.asFileTree.filter {it.extension == "jar"}
65-
setDestinationDir(project.file("/build/javadoc"))
64+
destinationDir = rootProject.file("build/javadoc")
6665
source = sourceSets.main.get().allJava
6766
// options.links = "https://docs.oracle.com/en/java/javase/17/docs/api/"
6867
// options.linkSource = true
@@ -72,7 +71,7 @@ val javadocs by tasks.registering(Javadoc::class) {
7271

7372
val javadocJar by tasks.registering(Jar::class) {
7473
archiveClassifier.set("javadoc")
75-
from(project.file("/build/javadoc"))
74+
from(rootProject.file("build/javadoc"))
7675
dependsOn(javadocs)
7776
}
7877

@@ -111,3 +110,21 @@ afterEvaluate {
111110
}
112111
}
113112
}
113+
114+
configure<PublishingExtension> {
115+
repositories {
116+
maven {
117+
name = "GitHubPackages"
118+
url = uri("https://maven.pkg.github.com/${project.ext.get("github_handle")}/${project.ext.get("plugin_identifier")}")
119+
credentials {
120+
username = System.getenv("GITHUB_ACTOR")
121+
password = System.getenv("GITHUB_TOKEN")
122+
}
123+
}
124+
}
125+
publications {
126+
register<MavenPublication>("gpr") {
127+
from(components["java"])
128+
}
129+
}
130+
}

settings.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,18 @@
11
// settings.gradle.kts
2+
23
pluginManagement {
34
repositories {
4-
mavenCentral {
5-
content {
6-
includeGroupByRegex("org.apache.*")
7-
}
8-
}
95
gradlePluginPortal {
106
content {
117
excludeGroupByRegex("org.apache.*")
128
includeGroupByRegex("com.gradle.*")
139
}
1410
}
11+
mavenCentral {
12+
content {
13+
includeGroupByRegex("org.apache.*")
14+
}
15+
}
1516
}
1617
}
1718

0 commit comments

Comments
 (0)