Skip to content
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

Extract Nexus URL using nexus-staging-maven-plugin #246

Merged
merged 4 commits into from
Oct 9, 2024
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
7 changes: 4 additions & 3 deletions .github/generate-email.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ stderr() {

fail_for_invalid_args() {
stderr "Invalid arguments!"
stderr "Expected arguments: <vote|announce> <version> <commitId>"
stderr "Expected arguments: <vote|announce> <version> <commitId> <nexusUrl>"
exit 1
}

# Check arguments
[ $# -ne 3 ] && fail_for_invalid_args
[ $# -ne 4 ] && fail_for_invalid_args

# Constants
PROJECT_NAME="Apache Logging Parent"
Expand All @@ -43,6 +43,7 @@ PROJECT_SITE="https://logging.apache.org/$PROJECT_ID"
PROJECT_STAGING_SITE="${PROJECT_SITE/apache.org/staged.apache.org}"
PROJECT_REPO="https://github.com/apache/$PROJECT_ID"
COMMIT_ID="$3"
NEXUS_URL="$4"
PROJECT_DIST_URL="https://dist.apache.org/repos/dist/dev/logging/$PROJECT_ID/$PROJECT_VERSION"

# Check release notes file
Expand Down Expand Up @@ -71,7 +72,7 @@ Website: $PROJECT_STAGING_SITE-$PROJECT_VERSION
GitHub: $PROJECT_REPO
Commit: $COMMIT_ID
Distribution: $PROJECT_DIST_URL
Nexus: https://repository.apache.org/content/repositories/orgapachelogging-<FIXME>
Nexus: $NEXUS_URL
Signing key: 0x077e8893a6dcc33dd4a4d5b256e73ba9a0b592d0
Review kit: https://logging.apache.org/logging-parent/release-review-instructions.html

Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/deploy-release-reusable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ jobs:
./mvnw \
--show-version --batch-mode --errors --no-transfer-progress \
-P deploy,release
export NEXUS_URL=$(awk '/^(stagingRepository.url)/ { gsub(/(^.+=|\\)/, ""); print $1 }' target/nexus-staging/staging/*.properties)
echo "NEXUS_URL=$NEXUS_URL" >> $GITHUB_ENV

# Node.js cache is needed for Antora
- name: Set up Node.js cache
Expand Down Expand Up @@ -273,7 +275,8 @@ jobs:

# Generate emails
for EMAIL_TYPE in vote announce; do
"$GITHUB_WORKSPACE/.github/generate-email.sh" $EMAIL_TYPE $PROJECT_VERSION $COMMIT_ID \
"$GITHUB_WORKSPACE/.github/generate-email.sh" \
"$EMAIL_TYPE" "$PROJECT_VERSION" "$COMMIT_ID" "$NEXUS_URL" \
> "${DIST_FILENAME_VERSIONED_PREFIX}-email-${EMAIL_TYPE}.txt"
done

Expand Down
43 changes: 36 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@
<log4j-changelog-maven-plugin.version>0.9.0</log4j-changelog-maven-plugin.version>
<maven-artifact-plugin.version>3.5.1</maven-artifact-plugin.version>
<restrict-imports-enforcer-rule.version>2.6.0</restrict-imports-enforcer-rule.version>
<sign-maven-plugin.version>1.1.0</sign-maven-plugin.version>
<spotbugs-maven-plugin.version>4.8.6.4</spotbugs-maven-plugin.version>
<spotless-maven-plugin.version>2.43.0</spotless-maven-plugin.version>
<xml-maven-plugin.version>1.1.0</xml-maven-plugin.version>
Expand Down Expand Up @@ -390,12 +389,6 @@
<version>${maven-artifact-plugin.version}</version>
</plugin>

<plugin>
<groupId>org.simplify4u.plugins</groupId>
<artifactId>sign-maven-plugin</artifactId>
<version>${sign-maven-plugin.version}</version>
</plugin>

<plugin>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-maven-plugin</artifactId>
Expand Down Expand Up @@ -1312,11 +1305,18 @@
<id>deploy</id>

<properties>

<!-- Global configuration -->
<deployAtEnd>true</deployAtEnd>
<installAtEnd>true</installAtEnd>
<skipTests>true</skipTests>
<spotbugs.skip>true</spotbugs.skip>
<spotless.check.skip>true</spotless.check.skip>

<!-- Plugin versions -->
<nexus-staging-maven-plugin.version>1.7.0</nexus-staging-maven-plugin.version>
<sign-maven-plugin.version>1.1.0</sign-maven-plugin.version>

</properties>

<build>
Expand All @@ -1328,6 +1328,7 @@
<plugin>
<groupId>org.simplify4u.plugins</groupId>
<artifactId>sign-maven-plugin</artifactId>
<version>${sign-maven-plugin.version}</version>
<executions>
<execution>
<goals>
Expand All @@ -1337,6 +1338,34 @@
</executions>
</plugin>

<!-- Skip `maven-deploy-plugin`, we will use `org.sonatype.plugins:nexus-staging-maven-plugin` instead -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>

<!-- Using Sonatype plugin, since it reports the resultant Nexus URL -->
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>${nexus-staging-maven-plugin.version}</version>
<executions>
<execution>
<id>default-deploy</id>
<goals>
<goal>deploy</goal>
</goals>
<configuration>
<nexusUrl>https://repository.apache.org</nexusUrl>
<serverId>${distMgmtReleasesId}</serverId>
</configuration>
</execution>
</executions>
</plugin>

</plugins>

</build>
Expand Down
8 changes: 8 additions & 0 deletions src/changelog/.11.x.x/change_nexus_deploy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://logging.apache.org/xml/ns"
xsi:schemaLocation="https://logging.apache.org/xml/ns https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
type="changed">
<issue id="246" link="https://github.com/apache/logging-parent/pull/246"/>
<description format="asciidoc">Switch from `maven-deploy-plugin` to `nexus-staging-maven-plugin`, which helps with fetching the Nexus repository URL during a release</description>
</entry>
Original file line number Diff line number Diff line change
Expand Up @@ -93,21 +93,13 @@ You can iterate on the `release/7.8.0` branch to perfect it.
+
If not, commit necessary fixes, push, and repeat.

. _Close_ the repository in https://repository.apache.org/[repository.apache.org] using a self-explanatory description, e.g., ``\`{project-id}` version \`7.8.0` RC1``

[#vote-release]
== Vote the release

. Send the vote email uploaded to the https://dist.apache.org/repos/dist/dev/logging/{project-id}/7.8.0[dist.apache.org/repos/dist/**dev**/logging/{project-id}/7.8.0] Subversion repository
+
[WARNING]
====
**Fix the cited https://repository.apache.org[repository.apache.org] URL** in the generated email!
It changes after every Nexus deployment.
====
+
[WARNING]
====
Make sure your email is sent in plain text, that is, https://infra.apache.org/contrib-email-tips#nohtml[no HTML]!
If you are using GMail, enable the _"Plain text mode"_ while composing your message.
====
Expand Down
Loading