Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions .github/actions/build-test-pack-deploy/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ runs:
gpg-private-key: ${{ inputs.gpg-private-key }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE # The name of the environment variable to use for GPG passphrase.

# server-id, server-username, and server-password need to be set to avoid errors from
# central-publishing-maven-plugin, even though the plugin is configured with skipPublishing=true
server-id: central
server-username: MAVEN_CENTRAL_USERNAME
server-password: MAVEN_CENTRAL_PASSWORD

- name: Compute version
id: version
shell: bash
Expand Down Expand Up @@ -62,15 +56,13 @@ runs:
shell: bash
# One full Maven lifecycle run.
#
# central-publishing-maven-plugin is configured with skipPublishing=true, so it assembles
# central-publishing-maven-plugin is configured with skipUpload=true, so it assembles
# target/central-publishing/central-bundle.zip and generates checksums without uploading.
#
# GPG signing is skipped for fork PRs as forks don't receive repository secrets. These builds are not published to
# Octopus, so signing is not required.
env:
MAVEN_GPG_PASSPHRASE: ${{ inputs.gpg-passphrase }}
MAVEN_CENTRAL_USERNAME: placeholder
MAVEN_CENTRAL_PASSWORD: placeholder
run: mvn -B clean deploy ${{ github.event.pull_request.head.repo.fork == true && '-Dgpg.skip=true' || '' }}

- name: Name the bundle
Expand All @@ -79,6 +71,10 @@ runs:
run: |
SRC="target/central-publishing/central-bundle.zip"
[ -f "$SRC" ] || { echo "Error: bundle not found at $SRC"; exit 1; }
# Maven Central rejects bundles containing local-repository metadata.
if unzip -l "$SRC" | grep -E 'maven-metadata-local\.xml|_remote\.repositories'; then
echo "Error: bundle contains local-repository metadata files"; exit 1
fi
Comment on lines +74 to +77

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we really need this, but doesn't hurt.

DEST="octopus-openfeature-provider-java.${{ steps.version.outputs.version }}.zip"
mv "$SRC" "$DEST"
echo "path=$DEST" >> "$GITHUB_OUTPUT"
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.8.0</version>
<version>0.12.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<skipPublishing>true</skipPublishing> <!-- Octopus owns the upload to Maven Central. -->
<skipUpload>true</skipUpload> <!-- Octopus owns the upload to Maven Central. -->
</configuration>
</plugin>
<plugin>
Expand Down
Loading