-
Notifications
You must be signed in to change notification settings - Fork 20
Migrate to vanniktech maven publish #2300
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 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,51 @@ | ||
| name: Publish snapshot | ||
|
|
||
| env: | ||
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_TOKEN_USER }} | ||
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }} | ||
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }} | ||
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.MAVEN_ANDROID_GPG_KEY }} | ||
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }} | ||
|
|
||
| on: | ||
| schedule: | ||
| - cron: '0 5 * * *' # Runs every day at 5:00 UTC | ||
| workflow_dispatch: | ||
| inputs: | ||
| snapshot_name: | ||
| description: 'Name of the snapshot to be published. -SNAPSHOT will be appended automatically, so just add a name. e.g. 7.7.0' | ||
| required: false | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| release: | ||
| timeout-minutes: 60 | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Set snapshot_name in gradle.properties if set | ||
| env: | ||
| SNAPSHOT_NAME: ${{ inputs.snapshot_name }} | ||
| run: | | ||
| if [ -n "$SNAPSHOT_NAME" ]; then | ||
| sed -i -r "s#^version=.*#version=${SNAPSHOT_NAME}-SNAPSHOT#" gradle.properties | ||
| git add gradle.properties | ||
| fi | ||
|
|
||
| - name: Fail if version is not -SNAPSHOT | ||
| run: | | ||
| grep -q -- '-SNAPSHOT$' gradle.properties || (echo "ERROR: version must end with -SNAPSHOT" && exit 1) | ||
|
|
||
| - name: Setup Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'adopt' | ||
|
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. Is there a way we can apply the same Java config to all of our builds, production, snapshot, and otherwise?
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. we could use a shared workflow, though I'm not sure if it'd work |
||
| java-version: 17 | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 | ||
|
|
||
| - name: Publish to Maven Central | ||
| run: | | ||
| ./gradlew publishToMavenCentral --no-configuration-cache --stacktrace | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,74 +0,0 @@ | ||
| name: Release RC and Update Docs | ||
|
|
||
| env: | ||
| SONATYPE_USERNAME: ${{ secrets.SONATYPE_TOKEN_USER }} | ||
| SONATYPE_PASSWORD: ${{ secrets.SONATYPE_TOKEN_USER_PASSWORD }} | ||
| MAVEN_QA_USER: github | ||
| MAVEN_QA_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} | ||
| mavenSigningKeyId: ${{ secrets.MAVEN_ANDROID_SIGNING_KEY }} | ||
| mavenSigningKeyRingFileEncoded: ${{ secrets.MAVEN_ANDROID_GPG_KEY }} | ||
| mavenSigningKeyPassword: ${{ secrets.MAVEN_ANDROID_SIGNING_PASSWORD }} | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| rc_version: | ||
| description: 'SDK version this workflow run will release. Specify <major.minor.patch> e.g. 7.1.2. It will use the branch "release/<version>".' | ||
| required: true | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| release-to-maven-central: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
| steps: | ||
| - name: Validate access to version data service | ||
| uses: embrace-io/public-actions/upload-sdk-version@88167cd1a3fce3418e26c8c842026e6dfab99e41 | ||
| with: | ||
| platform: 'android' | ||
| version: ${{ inputs.rc_version }} | ||
| dryRun: true | ||
| uploadUrl: ${{ vars.SDK_VERSION_URL }} | ||
| env: | ||
| SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }} | ||
|
|
||
| - name: Checkout SDK | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| ref: release/${{ inputs.rc_version }} | ||
| fetch-depth: 0 | ||
| persist-credentials: false | ||
|
|
||
| - name: Setup Java | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: 'adopt' | ||
| java-version: 17 | ||
|
|
||
| - name: Setup Gradle | ||
| uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1 | ||
|
|
||
| - name: Release to Maven Central | ||
| run: | | ||
| ./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository -Dorg.gradle.parallel=false --no-build-cache --no-configuration-cache --stacktrace | ||
|
|
||
| - name: Record SDK Version History | ||
| uses: embrace-io/public-actions/upload-sdk-version@88167cd1a3fce3418e26c8c842026e6dfab99e41 | ||
| with: | ||
| platform: 'android' | ||
| version: ${{ inputs.rc_version }} | ||
| dryRun: false | ||
| uploadUrl: ${{ vars.SDK_VERSION_URL }} | ||
| env: | ||
| SDK_VERSION_TOKEN: ${{ secrets.SDK_VERSION_TOKEN }} | ||
|
|
||
| publish-api-docs: | ||
| name: Publish API Docs to GitHub Pages | ||
| uses: ./.github/workflows/publish-api-docs.yml | ||
| secrets: inherit | ||
| permissions: | ||
| contents: write | ||
| with: | ||
| rc_version: ${{ inputs.rc_version }} | ||
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.
It is ok to pin things to this SHA?
Uh oh!
There was an error while loading. Please reload this page.
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.
That's how it's done everywhere, at least for this particular action. I'm not a fan, but I think it's the only way to make an action immutable. @fnewberg might have additional reasons
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.
Feels like "current version" should be defined as a variable and be referenced everywhere so we don't have to make N changes when the version revs. Not a blocker - just something to consider.