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

ICU-22721 Prevent inconsistent ICU4J Maven deploys via CI #2970

Merged
merged 1 commit into from
Apr 22, 2024
Merged
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
45 changes: 43 additions & 2 deletions .github/workflows/maven.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ jobs:
runs-on: ubuntu-latest
permissions:
packages: write
outputs:
version: ${{ steps.mvn-proj-version.outputs.version }}
version-type: ${{ steps.mvn-proj-version-type.outputs.version-type }}
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
Expand All @@ -25,11 +28,34 @@ jobs:
with:
distribution: 'temurin'
java-version: '11'
- name: icu4j and releaseCLDR
- name: Store Maven project version
id: mvn-proj-version
run: |
cd icu4j
version="`mvn help:evaluate -Dexpression=project.version -q -DforceStdout`"
echo "version=$version" # debug/info logging for our own purposes, before sending to Github
echo "version=$version" >> "$GITHUB_OUTPUT"
# Set version-type=snapshot for tags that contain SNAPSHOT,
# as well as for unicode-org-internal artifacts with a dash like `icu4j-for-cldr`.
- name: Assess Maven version release/snapshot
id: mvn-proj-version-type
run: |
if echo "${{ steps.mvn-proj-version.outputs.version }}" | grep -E "\-|SNAPSHOT"
then echo "version-type=snapshot" >> "$GITHUB_OUTPUT"
else echo "version-type=release" >> "$GITHUB_OUTPUT"
fi
- name: Prevent manual deployment attempts of full release
if: github.event_name == 'workflow_dispatch' && steps.mvn-proj-version-type.outputs.version-type == 'release'
run: |
echo "Manual deployments of publishing artifacts should only be attempted for snapshot versions"
exit 1;
- name: Build artifacts (icu4j, utilities-for-cldr)
run: |
cd icu4j
mvn ${SHARED_MVN_ARGS} clean install -DskipTests -DskipIT -P with_sources
- name: deploy it
# For snapshot versions, publish icu4j & utilities-for-cldr
- name: Deploy to Github (snapshot version)
if: steps.mvn-proj-version-type.outputs.version-type == 'snapshot'
run: |
echo Github Ref ${GITHUB_REF} @ ${GITHUB_SHA};
cd icu4j
Expand All @@ -39,5 +65,20 @@ jobs:
-P cldr_utilities,with_sources
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# For release versions, publish utilities-for-cldr,
# but do not publish icu4j because the Maven artifact "coordinates"
# will conflict with the public-facing coordinates on Maven Central
# ("coordinates" = groupId, artifactId, version)
- name: Deploy to Github (release version)
if: steps.mvn-proj-version-type.outputs.version-type == 'release'
run: |
echo Github Ref ${GITHUB_REF} @ ${GITHUB_SHA};
cd icu4j
mvn deploy ${SHARED_MVN_ARGS} \
-pl :utilities-for-cldr,:icu4j-root \
-DaltDeploymentRepository=github::https://maven.pkg.github.com/${GITHUB_REPOSITORY} \
-P cldr_utilities,with_sources
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Note: can use 0.0.0-${GITHUB_SHA} as the version for hash-based.
# i.e. build on every commit