-
Notifications
You must be signed in to change notification settings - Fork 83
ci: migrate release to Sonatype Central Portal via nexus-publish #703
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
ca1590a
7bab5b9
7a5073e
f067580
86602c1
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 |
|---|---|---|
| @@ -1,58 +1,40 @@ | ||
| name: Publish release to Java | ||
|
|
||
| inputs: | ||
| java-version: | ||
| required: true | ||
| ossr-username: | ||
| required: true | ||
| ossr-password: | ||
| ossr-token: | ||
| required: true | ||
| signing-key: | ||
| required: true | ||
| signing-password: | ||
| required: true | ||
| java-version: | ||
| required: true | ||
| is-android: | ||
| required: true | ||
| version: | ||
| required: true | ||
|
|
||
|
|
||
| runs: | ||
| using: composite | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # pin@v4.4.0 | ||
|
|
||
| - name: Setup Java | ||
| shell: bash | ||
| run: | | ||
| curl -s "https://get.sdkman.io" | bash | ||
| source "/home/runner/.sdkman/bin/sdkman-init.sh" | ||
| sdk list java | ||
| sdk install java "$JAVA_VERSION" && sdk default java "$JAVA_VERSION" | ||
| env: | ||
| JAVA_VERSION: ${{ inputs.java-version }} | ||
| - name: Set up Java | ||
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # pin@v4 | ||
| with: | ||
| distribution: 'temurin' | ||
| java-version: ${{ inputs.java-version }} | ||
| cache: 'gradle' | ||
|
|
||
| - uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # pin@1.1.0 | ||
|
|
||
| - name: Publish Java | ||
| shell: bash | ||
| if: inputs.is-android == 'false' | ||
| run: ./gradlew clean assemble sign publishMavenJavaPublicationToMavenRepository -PisSnapshot=false -Pversion="$VERSION" -PossrhUsername="$OSSR_USERNAME" -PossrhPassword="$OSSR_PASSWORD" -PsigningKey="$SIGNING_KEY" -PsigningPassword="$SIGNING_PASSWORD" | ||
| env: | ||
| VERSION: ${{ inputs.version }} | ||
| OSSR_USERNAME: ${{ inputs.ossr-username }} | ||
| OSSR_PASSWORD: ${{ inputs.ossr-password }} | ||
| SIGNING_KEY: ${{ inputs.signing-key }} | ||
| SIGNING_PASSWORD: ${{ inputs.signing-password }} | ||
| - name: Set up Gradle | ||
| uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # pin@v5 | ||
|
|
||
| - name: Publish Android | ||
| - name: Publish Android/Java Packages to Maven | ||
| shell: bash | ||
| if: inputs.is-android == 'true' | ||
| run: ./gradlew clean assemble sign publishAndroidLibraryPublicationToMavenRepository -PisSnapshot=false -Pversion="$VERSION" -PossrhUsername="$OSSR_USERNAME" -PossrhPassword="$OSSR_PASSWORD" -PsigningKey="$SIGNING_KEY" -PsigningPassword="$SIGNING_PASSWORD" | ||
| run: ./gradlew publishToSonatype closeSonatypeStagingRepository -PisSnapshot=false --stacktrace | ||
|
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.
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. Keeping — needed for diagnosing publish failures in CI logs. |
||
| env: | ||
| VERSION: ${{ inputs.version }} | ||
| OSSR_USERNAME: ${{ inputs.ossr-username }} | ||
| OSSR_PASSWORD: ${{ inputs.ossr-password }} | ||
| MAVEN_USERNAME: ${{ inputs.ossr-username }} | ||
| MAVEN_PASSWORD: ${{ inputs.ossr-token }} | ||
| SIGNING_KEY: ${{ inputs.signing-key }} | ||
| SIGNING_PASSWORD: ${{ inputs.signing-password }} | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,19 +9,63 @@ on: | |
| permissions: | ||
| contents: write | ||
|
|
||
| ### TODO: Replace instances of './.github/workflows/' w/ `auth0/dx-sdk-actions/workflows/` and append `@latest` after the common `dx-sdk-actions` repo is made public. | ||
| ### TODO: Also remove `get-prerelease`, `get-release-notes`, `get-version`, `maven-publish`, `release-create`, and `tag-exists` actions from this repo's .github/actions folder once the repo is public. | ||
| ### TODO: Also remove `java-release` workflow from this repo's .github/workflows folder once the repo is public. | ||
|
|
||
| jobs: | ||
| release: | ||
| uses: ./.github/workflows/java-release.yml | ||
| with: | ||
| java-version: 8.0.382-tem | ||
| is-android: true | ||
| secrets: | ||
| ossr-username: ${{ secrets.OSSR_USERNAME }} | ||
| ossr-password: ${{ secrets.OSSR_PASSWORD }} | ||
| signing-key: ${{ secrets.SIGNING_KEY }} | ||
| signing-password: ${{ secrets.SIGNING_PASSWORD }} | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
| if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.merged && startsWith(github.event.pull_request.head.ref, 'release/')) | ||
| runs-on: ubuntu-latest | ||
| environment: release | ||
|
|
||
| steps: | ||
| # Checkout the code | ||
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # pin@v7.0.1 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| # Get the version from the branch name | ||
| - id: get_version | ||
| uses: ./.github/actions/get-version | ||
|
|
||
| # Get the prerelease flag from the branch name | ||
| - id: get_prerelease | ||
| uses: ./.github/actions/get-prerelease | ||
| with: | ||
| version: ${{ steps.get_version.outputs.version }} | ||
|
|
||
| # Get the release notes | ||
| - id: get_release_notes | ||
| uses: ./.github/actions/get-release-notes | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| version: ${{ steps.get_version.outputs.version }} | ||
| repo_owner: ${{ github.repository_owner }} | ||
| repo_name: ${{ github.event.repository.name }} | ||
|
|
||
| # Check if the tag already exists | ||
| - id: tag_exists | ||
| uses: ./.github/actions/tag-exists | ||
| with: | ||
| tag: ${{ steps.get_version.outputs.version }} | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| # If the tag already exists, exit with an error | ||
| - if: steps.tag_exists.outputs.exists == 'true' | ||
| run: exit 1 | ||
|
|
||
| # Publish the release to Maven | ||
| - uses: ./.github/actions/maven-publish | ||
| with: | ||
| java-version: '11' | ||
|
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. Was the switch from
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. Yes, intentional — standardising on JDK 11 with actions/setup-java. sourceCompatibility 1.8 / targetCompatibility 1.8 are unchanged so the bytecode output is identical. |
||
| ossr-username: ${{ secrets.OSSR_USERNAME }} | ||
| ossr-token: ${{ secrets.OSSR_TOKEN }} | ||
| signing-key: ${{ secrets.SIGNING_KEY }} | ||
| signing-password: ${{ secrets.SIGNING_PASSWORD }} | ||
|
|
||
| # Create a release for the tag | ||
| - uses: ./.github/actions/release-create | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| name: ${{ steps.get_version.outputs.version }} | ||
| body: ${{ steps.get_release_notes.outputs.release-notes }} | ||
| tag: ${{ steps.get_version.outputs.version }} | ||
| commit: ${{ github.sha }} | ||
| prerelease: ${{ steps.get_prerelease.outputs.prerelease }} | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "files": { | ||
| "auth0/build.gradle": [], | ||
| "lib/build.gradle": [], | ||
| ".version": [], | ||
| "README.md": [] | ||
| }, | ||
|
|
||
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.
This checkout is redundant —
release.ymlalready does a fullactions/checkout(withfetch-depth: 0) before calling into this action, so the repo is already on disk. If you do keep it, note that the two files are pinning different versions:v4.4.0here vsv7.0.1in the workflow, which looks unintentional.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.
Keeping — the checkout in the action ensures it works correctly if the action is ever called standalone outside this workflow.