-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Package Pre-Release #14
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
Changes from 60 commits
a6bc34c
fd1f625
e0a68c4
068748e
b26570a
3e2c56c
c9f24f3
03c10b5
0141739
31c1524
82ce7fa
8d70d51
2baa4c1
ead9d89
683d9fd
f4dced6
c4bbffb
d4cae59
073dcb7
bb8fb9a
f31b56a
e903ddb
3a4945f
32c1d97
6195470
170a48f
5f469c7
a96670a
048a30a
96e0f5d
706fce2
fc7bc24
a186dbd
ce4c870
48b7f3f
5796291
df28180
70d7b12
0ec0588
89c7a04
cbd35e5
31a8005
265dcea
84e58b8
639efbb
2482aea
4e8ba41
a3ae992
a9fe7d2
e5d0a4d
d7f2160
b39a163
e70fc54
d398c64
1f3723d
7ebcde0
336d203
13bfa58
f745ebc
9fa5c5d
03f18f3
fbf3d68
eb9c78e
f8f4315
4926e94
c74f8d6
f12bc80
e674538
06bc1f1
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,18 @@ | ||
| name: Decode signing key | ||
| description: 'Decodes gpg key into file' | ||
| inputs: | ||
| signing_key_file: | ||
| description: 'Signing key file' | ||
| required: true | ||
| default: '' | ||
| signing_file_path: | ||
| description: 'Signing file path' | ||
| required: true | ||
| default: '' | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - run: | | ||
| echo "${{inputs.signing_key_file}}" > ~/secretKey.gpg.b64 | ||
| base64 -d ~/secretKey.gpg.b64 > ${{ inputs.signing_file_path }} | ||
| shell: bash | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| name: 'Publish All Modules' | ||
| description: 'Publishes all modules' | ||
| inputs: | ||
| sonatype_usr: | ||
| description: 'Sonatype user' | ||
| required: true | ||
| default: '' | ||
| sonatype_pwd: | ||
| description: 'Sonatype password' | ||
| required: true | ||
| default: '' | ||
| signing_key_id: | ||
| description: 'Signing key id' | ||
| required: true | ||
| default: '' | ||
| signing_key_pwd: | ||
|
||
| description: 'Signing key password' | ||
| required: true | ||
| default: '' | ||
| signing_key_file: | ||
| description: 'Signing key file' | ||
| required: true | ||
| default: '' | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - run: | | ||
| ./gradlew --stacktrace clean publishToSonatype closeAndReleaseSonatypeStagingRepository | ||
| shell: bash | ||
| env: | ||
| SONATYPE_NEXUS_USERNAME: ${{ inputs.sonatype_usr }} | ||
| SONATYPE_NEXUS_PASSWORD: ${{ inputs.sonatype_pwd }} | ||
| SIGNING_KEY_ID: ${{ inputs.signing_key_id }} | ||
| SIGNING_KEY_PASSWORD: ${{ inputs.signing_key_pwd }} | ||
| SIGNING_KEY_FILE: ${{ inputs.signing_key_file }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,18 @@ | ||
| name: Build | ||
| on: [pull_request, workflow_dispatch] | ||
| on: | ||
| pull_request: {} | ||
| workflow_dispatch: {} | ||
| workflow_call: | ||
| secrets: | ||
| SIGNING_KEY_ID: | ||
| description: 'Secret Key ID' | ||
| required: true | ||
| SIGNING_KEY_FILE: | ||
| description: 'Secret Key' | ||
| required: true | ||
| SIGNING_KEY_PASSWORD: | ||
| description: 'Secret Password' | ||
| required: true | ||
|
|
||
| concurrency: | ||
| group: build-${{ github.event.number }} | ||
|
|
@@ -10,6 +23,9 @@ jobs: | |
| name: Build | ||
|
||
| runs-on: ubuntu-latest | ||
|
|
||
| env: | ||
| SIGNING_KEY_FILE_PATH: /home/runner/secretKey.gpg | ||
|
|
||
| strategy: | ||
| matrix: | ||
| codebase: [library, demo] | ||
|
|
@@ -25,8 +41,19 @@ jobs: | |
| distribution: 'temurin' | ||
| cache: gradle | ||
|
|
||
| # Only library assets are needed for the build step | ||
| - name: Build with Gradle | ||
| run: ./gradlew :${{ matrix.codebase }}:assemble | ||
| #After decoding the secret key, place the file in ~ /. Gradle/ secring.gpg | ||
| - name: Decode Signing Key | ||
| uses: ./.github/actions/decode_signing_key_action | ||
| with: | ||
| signing_key_file: ${{ secrets.SIGNING_KEY_FILE }} | ||
| signing_file_path: ${{ env.SIGNING_KEY_FILE_PATH }} | ||
|
|
||
| - name: Assemble | ||
| run: ./gradlew --stacktrace assemble -x :demo:assemble # we exclude Demo module in assemble | ||
|
||
| env: | ||
| SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | ||
| SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | ||
| SIGNING_KEY_FILE: ${{ env.SIGNING_KEY_FILE_PATH }} | ||
|
|
||
| - run: echo "Build status report=${{ job.status }}." | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,53 +1,50 @@ | ||
| name: Release | ||
| on: | ||
| workflow_dispatch: {} | ||
| push: | ||
| branches: | ||
| - main | ||
| env: | ||
| SIGNING_KEY_FILE_PATH: /home/runner/secretKey.gpg | ||
|
|
||
| jobs: | ||
| lint: | ||
| uses: paypal/paypal-messages-android/.github/workflows/lint.yml@release | ||
| uses: ./.github/workflows/lint.yml | ||
|
|
||
| test: | ||
| uses: paypal/paypal-messages-android/.github/workflows/test.yml@release | ||
| uses: ./.github/workflows/test.yml | ||
|
|
||
| build: | ||
| uses: paypal/paypal-messages-android/.github/workflows/build.yml@release | ||
|
|
||
| uses: ./.github/workflows/build.yml | ||
| secrets: | ||
| SIGNING_KEY_FILE: ${{ secrets.SIGNING_KEY_FILE }} | ||
| SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | ||
| SIGNING_KEY_PASSWORD: ${{ secrets.SIGNING_KEY_PASSWORD }} | ||
|
|
||
| # after build and unit tests are finished, publish all modules at once | ||
| # to help reduce the probability of failure when interacting with sonatype servers | ||
| release: | ||
| name: Release | ||
| needs: [linting, tests, build] | ||
| needs: [lint, test, build] | ||
| name: Publish To Sonatype | ||
| runs-on: ubuntu-latest | ||
|
|
||
| permissions: | ||
| contents: write | ||
| issues: write | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Checkout repo | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| # pulls all commits (needed for semantic release to correctly version) | ||
| fetch-depth: '0' | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up JDK 17 | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@v2 | ||
| - name: Set up Java 17 | ||
| uses: actions/setup-java@v3 | ||
| with: | ||
| java-version: '17' | ||
| distribution: 'temurin' | ||
| cache: gradle | ||
|
|
||
| - name: Install Dependencies | ||
| run: | | ||
| npm i -g @semantic-release/exec @semantic-release/changelog @semantic-release/git conventional-changelog-conventionalcommits@6.1.0 | ||
|
|
||
| - name: GitHub Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| run: npx semantic-release@21 | ||
|
Contributor
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. We still want to keep a GitHub release in line with our published packages, so these should stick around in some fashion
Contributor
Author
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. Added back |
||
|
|
||
| distribution: 'microsoft' | ||
|
Contributor
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. I'm checking with Steven on the difference but if we're updating the distribution here, we should probably update it everywhere for consistency Steven said it shouldn't matter which one we use, but since that team is using Microsoft, let's switch it everywhere to Microsoft
Contributor
Author
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. sounds good |
||
| - name: Decode Signing Key | ||
| uses: ./.github/actions/decode_signing_key_action | ||
| with: | ||
| signing_key_file: ${{ secrets.SIGNING_KEY_FILE }} | ||
| signing_file_path: ${{ env.SIGNING_KEY_FILE_PATH }} | ||
| # - name: Update Version | ||
| # run: | | ||
| # ./gradlew -PversionParam=${{ github.event.inputs.version }} changeReleaseVersion | ||
| - name: Publish to Maven | ||
|
Contributor
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. Here it says "Publish to Maven" but above it says "Publish to Sonatype". Why the difference?
Contributor
Author
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. I think I didn't see name when I updated it. I'll make them align |
||
| run: echo "Publish to Maven" | ||
| uses: ./.github/actions/publish_all_modules | ||
| with: | ||
| sonatype_usr: ${{ secrets.SONATYPE_NEXUS_USERNAME }} | ||
| sonatype_pwd: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} | ||
| signing_key_id: ${{ secrets.SIGNING_KEY_ID }} | ||
| signing_key_pwd: ${{ secrets.SIGNING_KEY_PASSWORD }} | ||
| signing_key_file: ${{ env.SIGNING_KEY_FILE_PATH }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,11 +2,29 @@ | |
| import org.jmailen.gradle.kotlinter.tasks.LintTask | ||
| import org.jmailen.gradle.kotlinter.tasks.FormatTask | ||
|
|
||
| buildscript { | ||
| ext.modules = [ | ||
| "sdkVersionName" : "1.0.1-SNAPSHOT", | ||
| "sdkVersionCode" : 18, | ||
| "androidMinSdkVersion": 21, | ||
| "androidTargetVersion": 30 | ||
| ] | ||
|
|
||
| ext.versions = [ | ||
| "kotlin" : "1.8.21", | ||
| "compose" : "1.4.7", | ||
| "navigation": "2.3.5", | ||
| "hilt" : "2.44" | ||
| ] | ||
|
Contributor
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. Where are these module and version variables used?
Contributor
Author
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. Not used. Removing |
||
| } | ||
|
|
||
| plugins { | ||
| id 'com.android.application' version '8.0.2' apply false | ||
| id 'com.android.library' version '8.0.2' apply false | ||
| id 'org.jetbrains.kotlin.android' version '1.8.22' apply false | ||
| id 'org.jmailen.kotlinter' version '3.16.0' | ||
| id "io.github.gradle-nexus.publish-plugin" version "1.1.0" | ||
| id 'signing' | ||
| } | ||
|
|
||
| tasks.register('ktLint', LintTask) { | ||
|
|
@@ -22,3 +40,24 @@ tasks.register('ktFormat', FormatTask) { | |
| source files('demo/src', 'library/src') | ||
| report = file('build/reports/ktlint/format-report.txt') | ||
| } | ||
|
|
||
| version "1.0.0-alpha.00-SNAPSHOT" // we add it here so that nexus automatically chooses staging or snapshot repo | ||
|
||
|
|
||
| nexusPublishing { | ||
| repositories { | ||
| sonatype { | ||
| username = System.getenv('SONATYPE_NEXUS_USERNAME') ?: '' | ||
| password = System.getenv('SONATYPE_NEXUS_PASSWORD') ?: '' | ||
| repositoryDescription = "Paypal Messages" | ||
| packageGroup = "com.paypal" | ||
| } | ||
| } | ||
| transitionCheckOptions { | ||
| // give nexus sonatype more time to close the staging repository | ||
| delayBetween.set(Duration.ofSeconds(20)) | ||
| } | ||
| } | ||
|
|
||
| subprojects { | ||
| group = "com.paypal.messages" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| apply plugin: 'maven-publish' | ||
| apply plugin: 'signing' | ||
|
|
||
|
|
||
| ext["signing.keyId"] = System.getenv('SIGNING_KEY_ID') ?: '' | ||
| ext["signing.password"] = System.getenv('SIGNING_KEY_PASSWORD') ?: '' | ||
| ext["signing.secretKeyRingFile"] = System.getenv('SIGNING_KEY_FILE') ?: '' | ||
|
|
||
| afterEvaluate { | ||
| publishing { | ||
| publications { | ||
| release(MavenPublication) { | ||
| groupId group | ||
| version project.ext.version | ||
| artifactId project.ext.name | ||
| from components.release | ||
| // artifact androidSourcesJar //TODO: add javadocs | ||
|
|
||
| pom { | ||
| name = project.ext.pom_name ?: '' | ||
| packaging = POM_PACKAGING | ||
| description = project.ext.pom_desc ?: '' | ||
| url = POM_URL | ||
| licenses { | ||
| license { | ||
| name = POM_LICENCE_NAME | ||
| url = POM_LICENCE_URL | ||
| } | ||
| } | ||
| 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 | ||
| } | ||
| } | ||
|
|
||
| } | ||
| } | ||
| repositories { | ||
| maven { | ||
| url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") | ||
| } | ||
| } | ||
| } | ||
|
|
||
| signing { | ||
| sign publishing.publications | ||
| sign configurations.archives | ||
| } | ||
| } | ||
|
|
||
| task androidSourcesJar(type: Jar) { | ||
| archiveClassifier.set('sources') | ||
| from android.sourceSets.main.java.srcDirs | ||
| from android.sourceSets.main.kotlin.srcDirs | ||
| } | ||
|
|
||
| artifacts { | ||
| archives androidSourcesJar | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.