-
Notifications
You must be signed in to change notification settings - Fork 36
@W-21191311 Enable publishing to new Sonatype portal #162
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 |
|---|---|---|
|
|
@@ -53,18 +53,18 @@ jobs: | |
| mvn -V -gs $GITHUB_WORKSPACE/generated-settings/settings.xml -B -P sign-artifacts,db-tests,presto,skip-presto-tests -e release:clean release:prepare && | ||
| echo "::set-output name=RELEASED_VERSION::$(grep scm.tag= release.properties | cut -d'=' -f2 | cut -c2-)" | ||
| env: | ||
| MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USER }} | ||
| MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | ||
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | ||
| MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USER_2 }} | ||
| MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_2 }} | ||
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN_2 }} | ||
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE_2 }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Perform Release | ||
| run: > | ||
| mvn -gs $GITHUB_WORKSPACE/generated-settings/settings.xml -B -P sign-artifacts,db-tests,releases,presto,skip-presto-tests -e release:perform | ||
| env: | ||
| MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USER }} | ||
| MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | ||
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }} | ||
| MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USER_2 }} | ||
| MAVEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_2 }} | ||
| MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN_2 }} | ||
| MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE_2 }} | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Create Release Entry | ||
|
|
@@ -75,3 +75,12 @@ jobs: | |
| body: ${{ github.event.inputs.release-body }} | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Encode credentials to Base64 | ||
|
Collaborator
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 this section new? required?
Collaborator
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. According to the Sonatype doc, that new section is required: https://central.sonatype.org/publish/publish-portal-ossrh-staging-api/#configuring-the-repository. They even emphasize with "must".
Collaborator
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. This section?
Collaborator
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. "After all of the artifacts have been uploaded, your CI process should make a request to POST /manual/upload/defaultRepository/ where is the namespace that you see in https://central.sonatype.com/publishing/namespaces when you log in with the account that was used to generate the token. This must be done from the same IP that was used when uploading the files, so adding it to the end of your CI process is the most likely way for this to work reliably." |
||
| run: | | ||
| ENCODED_CREDENTIALS=$(echo -n "${{ secrets.MAVEN_CENTRAL_USER_2 }}:${{ secrets.MAVEN_CENTRAL_TOKEN_2 }}" | base64) | ||
| echo "::set-output name=ENCODED_CREDENTIALS::$ENCODED_CREDENTIALS" | ||
| id: encode_credentials_step | ||
| - name: Ensure visibility in Central Publisher Portal | ||
| run: | | ||
| curl -H "Authorization: Bearer ${{ steps.encode_credentials_step.outputs.ENCODED_CREDENTIALS }}" -i -X POST https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.salesforce.formula | ||
|
|
||
|
Collaborator
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. What exactly is this for? looks like it is used to upload files manually.
Collaborator
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. That's the POST request which is described in the Sonatype procedure which I linked. That request ensures visibility in the portal. |
||
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.
Would you also update these variable names in settings.xml and maven-publish.yml
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.
@sahil-here The values used in settings.xml are from the environment rather than from secrets and are set by maven-release.yml and maven-publish.yml. So, there's no need to make changes to settings.xml.
Also, some of the values which are used by settings.xml are set by maven-publish.yml but not by maven-release.yml. So, at first it seems that we need to update maven-publish.yml, as you requested. However, it seemed to me from our FE release process doc (https://salesforce.quip.com/xrT0AlfumtsI#UNXAAABdyzn) that we don't use maven-publish.yml. If we don't use maven-publish.yml, and if settings.xml depends upon maven-publish.yml, then it seems to me that neither maven-publish.yml nor settings.xml are being used. I was going to ask about that during Friday standup.
If we are actually using those files then I agree that I need to update maven-publish.yml. If we are not using those files then perhaps we should delete those files.
Please correct any misunderstandings I might have.
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.
I don't think the maven-publish.yml is being used, the GPG keys expired 2 years ago.
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.
Sounds good!
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.
I am not sure about settings.xml.
I checked and looks like maven-publish.yml does not have any history of workflows, not sure if there could still be something that might be running it, but it is not showing up alteast in this repo.
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.
@sahil-here I updated the secrets for maven-publish.yml.