-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add github action about docs and release #19
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. does this work as intended? as far as i can recall, this doesn't take into account users under a, authorized group :\ i think ampli has a working one There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you using the one in Ampli for Typescript now? I will do some test later after merge, may need to update if it is not working well. |
||
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 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,3 +33,7 @@ dependencies { | |
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
tasks.dokkaHtmlPartial.configure { | ||
failOnWarning.set(true) | ||
} |
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 | ||
[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/ |
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 | ||
} |
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 | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ts repo is using
docs
branch. i think it would be nice to standardize it. it doesnt matter to me if that ends up beinggh-pages
ordocs
branchThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe
gh-pages
is a traditional branch for github pages, when created the setting was just updated directly so just use this. Isdocs
the one you picked?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I was under the impression that gh-pages and docs are both traditional choices. I went with
docs
as it sound nicer for what we intend it to be