Skip to content

Commit d57304c

Browse files
committed
增加发布action
1 parent a1ebd67 commit d57304c

File tree

3 files changed

+53
-8
lines changed

3 files changed

+53
-8
lines changed

.github/workflows/publish.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Publish
2+
3+
on:
4+
release:
5+
# We'll run this workflow when a new GitHub release is created
6+
types: [released]
7+
jobs:
8+
publish:
9+
name: Release build and publish
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v2
14+
- name: Set up JDK 1.8
15+
uses: actions/setup-java@v1
16+
with:
17+
java-version: 1.8
18+
19+
# Base64 decodes and pipes the GPG key content into the secret file
20+
- name: Prepare environment
21+
env:
22+
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }}
23+
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
24+
run: |
25+
git fetch --unshallow
26+
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'"
27+
28+
# Builds the release artifacts of the library
29+
- name: Release build
30+
run: ./gradlew :CodeEditText:assembleRelease
31+
32+
# Generates other artifacts (javadocJar is optional)
33+
- name: Source jar and dokka
34+
run: ./gradlew :CodeEditText:androidSourcesJar :CodeEditText:javadocJar
35+
36+
# Runs upload, and then closes & releases the repository
37+
- name: Publish to MavenCentral
38+
run: ./gradlew :CodeEditText:publishReleasePublicationToSonatypeRepository --max-workers 1 closeAndReleaseSonatypeStagingRepository
39+
env:
40+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
41+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
42+
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
43+
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
44+
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}
45+
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,6 @@ android {
3030
dependencies {
3131
implementation fileTree(include: ['*.jar'], dir: 'libs')
3232
implementation "com.android.support:appcompat-v7:$SLVersion"
33-
// implementation 'com.github.lwjfork:CodeEditText:1.0.4'
34-
implementation project(':CodeEditText')
33+
implementation 'io.github.lwjfork:CodeEditText:1.0.5'
34+
3535
}

scripts/publish-root.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
apply plugin: 'io.github.gradle-nexus.publish-plugin'
22

3-
ext["signing.keyId"] = SIGNING_KEY_ID
4-
ext["signing.password"] = SIGNING_PASSWORD
5-
ext["signing.secretKeyRingFile"] = SIGNING_SECRET_KEY_RING_FILE
6-
ext["ossrhUsername"] = OSSRH_USERNAME
7-
ext["ossrhPassword"] = OSSRH_PASSWORD
3+
ext["signing.keyId"] = System.getenv("SIGNING_KEY_ID")
4+
ext["signing.password"] = System.getenv("SIGNING_PASSWORD")
5+
ext["signing.secretKeyRingFile"] = System.getenv("SIGNING_SECRET_KEY_RING_FILE")
6+
ext["ossrhUsername"] = System.getenv("OSSRH_USERNAME")
7+
ext["ossrhPassword"] = System.getenv("OSSRH_PASSWORD")
88

99

1010
nexusPublishing {
1111
repositories {
1212
sonatype { //only for users registered in Sonatype after 24 Feb 2021
1313
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
1414
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
15-
stagingProfileId = STAGING_PRO_FILE_ID
15+
stagingProfileId = System.getenv("SONATYPE_STAGING_PROFILE_ID")
1616
username = ossrhUsername
1717
password = ossrhPassword
1818
}

0 commit comments

Comments
 (0)