-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add github action about docs and release (#19)
- Loading branch information
1 parent
56c1d6a
commit 3aa868e
Showing
10 changed files
with
348 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Publish Docs | ||
|
||
on: workflow_dispatch | ||
|
||
jobs: | ||
build-and-deploy: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '11' | ||
distribution: 'zulu' | ||
|
||
- name: Checkout | ||
uses: actions/[email protected] | ||
|
||
- name: Setup Docs | ||
run: ./gradlew dokkaHtmlMultiModule | ||
|
||
- name: Deploy | ||
uses: JamesIves/[email protected] | ||
with: | ||
branch: gh-pages | ||
folder: docs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
dryRun: | ||
description: 'Do a dry run to preview instead of a real release' | ||
required: true | ||
default: 'true' | ||
|
||
jobs: | ||
authorize: | ||
name: Authorize | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: ${{ github.actor }} permission check to do a release | ||
uses: octokit/[email protected] | ||
with: | ||
route: GET /repos/:repository/collaborators/${{ github.actor }} | ||
repository: ${{ github.repository }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
release: | ||
name: Release | ||
runs-on: ubuntu-18.04 | ||
needs: [authorize] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK 1.8 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.8 | ||
|
||
- name: Build | ||
run: ./gradlew build | ||
|
||
- name: Lint | ||
run: ./gradlew ktlintCheck | ||
|
||
- name: Test | ||
run: ./gradlew test --info | ||
|
||
- name: Configure GPG | ||
env: | ||
GPG_KEY_CONTENTS: ${{ secrets.GPG_KEY_CONTENTS }} | ||
SIGNING_SECRET_KEY_RING_FILE: ${{ secrets.SIGNING_SECRET_KEY_RING_FILE }} | ||
run: | | ||
sudo bash -c "echo '$GPG_KEY_CONTENTS' | base64 -d > '$SIGNING_SECRET_KEY_RING_FILE'" | ||
- name: Configure Sonatype | ||
env: | ||
GRADLE_PROP_FILE: local.properties | ||
run: | | ||
echo "ossrhUsername=${{ secrets.OSSRH_USERNAME }}" >> $GRADLE_PROP_FILE | ||
echo "ossrhPassword=${{ secrets.OSSRH_PASSWORD }}" >> $GRADLE_PROP_FILE | ||
echo "sonatypeStagingProfileId=${{ secrets.SONATYPE_STAGING_PROFILE_ID }}" >> $GRADLE_PROP_FILE | ||
echo "signing.keyId=${{ secrets.SIGNING_KEY_ID }}" >> $GRADLE_PROP_FILE | ||
echo "signing.password=${{ secrets.SIGNING_PASSWORD }}" >> $GRADLE_PROP_FILE | ||
echo "signing.secretKeyRingFile=${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}" >> $GRADLE_PROP_FILE | ||
- name: Semantic Release --dry-run | ||
if: ${{ github.event.inputs.dryRun == 'true'}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GIT_AUTHOR_NAME: amplitude-sdk-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: amplitude-sdk-bot | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
run: | | ||
npx \ | ||
-p lodash \ | ||
-p semantic-release@17 \ | ||
-p @semantic-release/changelog@5 \ | ||
-p @semantic-release/git@9 \ | ||
-p @google/semantic-release-replace-plugin@1 \ | ||
-p @semantic-release/exec@5 \ | ||
semantic-release --dry-run | ||
- name: Semantic Release | ||
if: ${{ github.event.inputs.dryRun == 'false'}} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
GIT_AUTHOR_NAME: amplitude-sdk-bot | ||
GIT_AUTHOR_EMAIL: [email protected] | ||
GIT_COMMITTER_NAME: amplitude-sdk-bot | ||
GIT_COMMITTER_EMAIL: [email protected] | ||
run: | | ||
npx \ | ||
-p lodash \ | ||
-p semantic-release@17 \ | ||
-p @semantic-release/changelog@5 \ | ||
-p @semantic-release/git@9 \ | ||
-p @google/semantic-release-replace-plugin@1 \ | ||
-p @semantic-release/exec@5 \ | ||
semantic-release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,7 @@ dependencies { | |
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
tasks.dokkaHtmlPartial.configure { | ||
failOnWarning.set(true) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,19 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 | |
android.useAndroidX=true | ||
android.enableJetifier=true | ||
kotlin.code.style=official | ||
android.jetifier.ignorelist=bcprov-jdk15on-1.68.jar | ||
|
||
POM_URL=https\://github.com/amplitude//Amplitude-Kotlin | ||
POM_SCM_URL=https\://github.com/amplitude//Amplitude-Kotlin | ||
POM_SCM_CONNECTION=scm\:[email protected]\:amplitude/Amplitude-Kotlin.git | ||
POM_SCM_DEV_CONNECTION=scm\:[email protected]\:amplitude/Amplitude-Kotlin.git | ||
POM_LICENCE_NAME=MIT | ||
POM_LICENCE_URL=https\://opensource.org/licenses/MIT | ||
POM_LICENCE_DIST=repo | ||
POM_DEVELOPER_ID=amplitude_sdk_dev | ||
POM_DEVELOPER_NAME=Amplitude SDK Developers | ||
POM_DEVELOPER_EMAIL[email protected] | ||
POM_DEVELOPER_ORG=Amplitude | ||
POM_DEVELOPER_ORG_URL=https://amplitude.com/ | ||
RELEASE_REPOSITORY_URL=https://oss.sonatype.org/service/local/staging/deploy/maven2/ | ||
SNAPSHOT_REPOSITORY_URL=https://oss.sonatype.org/content/repositories/snapshots/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
apply plugin: 'org.jetbrains.dokka' | ||
|
||
task androidSourcesJar(type: Jar) { | ||
archiveClassifier.set('sources') | ||
if (project.plugins.findPlugin("com.android.library")) { | ||
from android.sourceSets.main.java.srcDirs | ||
from android.sourceSets.main.kotlin.srcDirs | ||
} else { | ||
from sourceSets.main.java.srcDirs | ||
from sourceSets.main.kotlin.srcDirs | ||
} | ||
} | ||
|
||
tasks.withType(dokkaHtmlPartial.getClass()).configureEach { | ||
pluginsMapConfiguration.set( | ||
["org.jetbrains.dokka.base.DokkaBase": """{ "separateInheritedMembers": true}"""] | ||
) | ||
} | ||
|
||
task javadocJar(type: Jar, dependsOn: dokkaJavadoc) { | ||
archiveClassifier.set('javadoc') | ||
from dokkaJavadoc.outputDirectory | ||
} | ||
|
||
artifacts { | ||
archives androidSourcesJar | ||
archives javadocJar | ||
} | ||
|
||
group = PUBLISH_GROUP_ID | ||
version = PUBLISH_VERSION | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
release(MavenPublication) { | ||
groupId PUBLISH_GROUP_ID | ||
artifactId PUBLISH_ARTIFACT_ID | ||
version PUBLISH_VERSION | ||
if (project.plugins.findPlugin("com.android.library")) { | ||
from components.release | ||
} else { | ||
from components.java | ||
} | ||
|
||
artifact androidSourcesJar | ||
artifact javadocJar | ||
|
||
pom { | ||
name = PUBLISH_NAME | ||
description = PUBLISH_DESCRIPTION | ||
url = POM_URL | ||
licenses { | ||
license { | ||
name = POM_LICENCE_NAME | ||
url = POM_LICENCE_URL | ||
distribution = POM_LICENCE_DIST | ||
} | ||
} | ||
developers { | ||
developer { | ||
id = POM_DEVELOPER_ID | ||
name = POM_DEVELOPER_NAME | ||
email = POM_DEVELOPER_EMAIL | ||
} | ||
} | ||
scm { | ||
connection = POM_SCM_CONNECTION | ||
developerConnection = POM_SCM_DEV_CONNECTION | ||
url = POM_SCM_URL | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
ext["signing.keyId"] = rootProject.ext["signing.keyId"] | ||
ext["signing.password"] = rootProject.ext["signing.password"] | ||
ext["signing.secretKeyRingFile"] = rootProject.ext["signing.secretKeyRingFile"] | ||
|
||
signing { | ||
sign publishing.publications | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// Create variables with empty default values | ||
ext["ossrhUsername"] = '' | ||
ext["ossrhPassword"] = '' | ||
ext["sonatypeStagingProfileId"] = '' | ||
ext["signing.keyId"] = '' | ||
ext["signing.password"] = '' | ||
ext["signing.secretKeyRingFile"] = '' | ||
|
||
File secretPropsFile = project.rootProject.file('local.properties') | ||
if (secretPropsFile.exists()) { | ||
// Read local.properties file first if it exists | ||
Properties p = new Properties() | ||
new FileInputStream(secretPropsFile).withCloseable { is -> p.load(is) } | ||
p.each { name, value -> ext[name] = value } | ||
} else { | ||
// Use system environment variables | ||
ext["ossrhUsername"] = System.getenv('OSSRH_USERNAME') | ||
ext["ossrhPassword"] = System.getenv('OSSRH_PASSWORD') | ||
ext["sonatypeStagingProfileId"] = System.getenv('SONATYPE_STAGING_PROFILE_ID') | ||
ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') | ||
ext["signing.password"] = System.getenv('SIGNING_PASSWORD') | ||
ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_SECRET_KEY_RING_FILE') | ||
} | ||
|
||
// Set up Sonatype repository | ||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
stagingProfileId = sonatypeStagingProfileId | ||
username = ossrhUsername | ||
password = ossrhPassword | ||
} | ||
} | ||
} |
Oops, something went wrong.