Skip to content

Commit

Permalink
ICU-22606 Make the ICU4J release easier & more predictable
Browse files Browse the repository at this point in the history
  • Loading branch information
mihnita committed Aug 29, 2024
1 parent 6645cc4 commit eda184e
Show file tree
Hide file tree
Showing 19 changed files with 282 additions and 147 deletions.
115 changes: 115 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path

name: Publish to Nexus Sonatype OSS

# For this to run you should define the follwing GitHub Secrets in the proper Environment.
# In Settings -- Environments -- release_env -- Environment secrets:
# * MAVEN_CENTRAL_USERNAME & MAVEN_CENTRAL_TOKEN:
# * Go to https://oss.sonatype.org and login with the `icu-robot` user
# * Top-right select "Profile"
# * Open the drop-down list showing "Summary" and select "User Token"
# * Click the "Access User Token" button
# * The `username` (first, shorter part of the token) goes in the `MAVEN_CENTRAL_USERNAME` secret
# * The `password` (second, longer part of the token) goes in the `MAVEN_CENTRAL_TOKEN` secret
# * MAVEN_GPG_PRIVATE_KEY: an ASCII dump of the GPG private signing key:
# `gpg --output icu_release_signing.asc --armor --export-secret-key <key_id>`
# * MAVEN_GPG_PASSPHRASE: the GPG password used to protect that key

on:
# To trigger the Env Test workflow manually, follow the instructions in
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
workflow_dispatch:
inputs:
gitTag:
# TODO: make this mandatory and validate that it is in a release* branch and looks like
# 'release-\d+.\d+ or something like that.
# For now we don't do it so that we can test.
description: 'Git tag at which to sync for deploy and release'
type: string

env:
SHARED_MVN_ARGS: '--no-transfer-progress --show-version --batch-mode'
RELEASE_FOLDER: 'target/release_files'

jobs:
publish:
runs-on: ubuntu-latest
environment: release-env
permissions:
contents: read
packages: write

steps:

- name: Checkout repo files
uses: actions/[email protected]
with:
lfs: true

- name: Set up JDK
uses: actions/[email protected]
with:
java-version: '8' # The custom Taglets for javadoc (tools/build) are still Java 8. They need updating to use a different JDK version.
distribution: 'temurin'
server-id: icu4j-maven-repo # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
settings-path: ${{ github.workspace }} # location for the settings.xml file

# TODO: enable tests? We don't want to release until we are 100% sure everything works.
- name: Build all of ICU
run: |
# Really important to do this first because we need `tools/build` for the javadoc applets
mvn install --file icu4j/tools/build \
${SHARED_MVN_ARGS} \
-DskipTests -DskipITs
- name: Build and deploy to Maven Central
run: |
mvn deploy --file icu4j \
${SHARED_MVN_ARGS} \
--settings $GITHUB_WORKSPACE/settings.xml \
--errors --fail-at-end -DdeployAtEnd=true \
-DskipTests -DskipITs \
-P with_sources,with_javadoc,with_signature
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

# These are files that will end in the "Release" section of the GitHub repo.
# So the jar files published in GitHub are binary identical to the ones in Maven Central.
- name: Prepare release folder
run: |
pushd icu4j
ICU_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
# Copy the artifacts (with sources and javdoc .jar files) to the release folder
mvn dependency:copy \
${SHARED_MVN_ARGS} \
-DskipTests -DskipITs \
-Drelease.directory=${RELEASE_FOLDER} \
-P release_files
# Build the full javadoc to be posted on the public site
mvn site \
${SHARED_MVN_ARGS} \
-DskipITs -DskipTests \
-P with_full_javadoc
jar -Mcf ${RELEASE_FOLDER}/icu4j-${ICU_VERSION}-fulljavadoc.jar \
-C target/site/apidocs/ .
# Create the file with MD5 checksums
pushd ${RELEASE_FOLDER}
md5sum *.jar > icu4j-${ICU_VERSION}.md5
popd # out of $RELEASE_FOLDER
popd # out of icu4j
# TODO: add them to the GitHub "Release" page automatically
- name: Upload build results
uses: actions/[email protected]
with:
path: ./icu4j/${{ env.RELEASE_FOLDER }}/*
retention-days: 3 # TBD if we want to keep them longer
overwrite: true

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ pkgdata.inc
pkgdataMakefile
rules.mk
.DS_Store
.flattened-pom.xml

!icu4c/source/samples/csdet/Makefile

Expand Down
7 changes: 0 additions & 7 deletions icu4j/demos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@

<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
Expand Down
12 changes: 12 additions & 0 deletions icu4j/main/charset/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<artifactId>icu4j-charset</artifactId>
<description>icu4j-charset is a supplemental library for icu4j, implementing Java Charset SPI.</description>
<url>${proj.url}</url>

<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
Expand Down Expand Up @@ -70,6 +71,17 @@
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We want to deploy this to Maven -->
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
12 changes: 0 additions & 12 deletions icu4j/main/collate/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

</project>
7 changes: 0 additions & 7 deletions icu4j/main/common_tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
7 changes: 0 additions & 7 deletions icu4j/main/core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,6 @@
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
12 changes: 0 additions & 12 deletions icu4j/main/currdata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

</project>
7 changes: 0 additions & 7 deletions icu4j/main/framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
12 changes: 12 additions & 0 deletions icu4j/main/icu4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<artifactId>icu4j</artifactId>
<description>International Components for Unicode for Java (ICU4J) is a mature, widely used Java library
providing Unicode and Globalization support</description>
<url>${proj.url}</url>

<properties>
<icu4j.api.doc.root.dir>${project.basedir}/../..</icu4j.api.doc.root.dir>
Expand Down Expand Up @@ -114,6 +115,17 @@
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We want to deploy this to Maven -->
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
12 changes: 0 additions & 12 deletions icu4j/main/langdata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

</project>
14 changes: 14 additions & 0 deletions icu4j/main/localespi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

<artifactId>icu4j-localespi</artifactId>
<description>icu4j-localespi is a supplemental library for icu4j, implementing Java Locale SPI.</description>
<url>${proj.url}</url>

<properties>
<proj.displayname>JDK locale service provider</proj.displayname>
Expand Down Expand Up @@ -185,6 +186,19 @@
</configuration>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
</plugin>

<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We want to deploy this to Maven -->
<configuration>
<skip>false</skip>
</configuration>
</plugin>

</plugins>
</build>

Expand Down
12 changes: 0 additions & 12 deletions icu4j/main/regiondata/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

</project>
12 changes: 0 additions & 12 deletions icu4j/main/translit/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,4 @@
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

</project>
9 changes: 1 addition & 8 deletions icu4j/perf-tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<dependency>
<groupId>commons-cli</groupId>
<artifactId>commons-cli</artifactId>
<version>1.7.0</version>
<version>${commons-cli.version}</version>
</dependency>
</dependencies>

Expand All @@ -63,13 +63,6 @@
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<!-- We don't want to deploy this to Maven -->
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>

Expand Down
Loading

0 comments on commit eda184e

Please sign in to comment.