Skip to content

Commit 0bb0b8e

Browse files
committed
ICU-22606 Create full release from CI - workflow files
The Ubuntu and Fedora files are very similar. But I am not sure (yet) what is the best way to share. The files uploaded to the GitHub Release use the exact same names as before. The .jar files are binary identical to the ones that go to Maven (checked). The Fedora Docker image should be built and uploaded from a dev machine. There is a workflow (from GitHub) doing that, but has a warning that: > This workflow uses actions that are not certified by GitHub. > They are provided by a third-party and are governed by > separate terms of service, privacy policy, and support documentation.
1 parent 5bc0b45 commit 0bb0b8e

File tree

6 files changed

+313
-18
lines changed

6 files changed

+313
-18
lines changed

.github/Dockerfile_fedora

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM fedora:latest
2+
3+
RUN dnf install -y gcc-c++ zip unzip git-core git-lfs doxygen
4+
RUN git lfs install --skip-repo \
5+
&& ln -s /usr/bin/python3 /usr/bin/python
6+
7+
WORKDIR /root
8+
9+
ENTRYPOINT [ "/bin/bash" ]

.github/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
## How to create a Fedora docker image
2+
3+
Run
4+
```
5+
docker login ghcr.io
6+
```
7+
8+
When prompted use these:
9+
10+
* **User:** the github user
11+
* **Password:** the github key
12+
13+
Update the timestamp (`20240929`) with the current date, ISO style:
14+
```
15+
docker build --tag ghcr.io/unicode-org/fedora-docker-gcr:20240929 -f Dockerfile_fedora .
16+
docker push ghcr.io/unicode-org/fedora-docker-gcr:20240929
17+
```
18+
19+
See:
20+
https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images
21+
22+
Also:
23+
https://stackoverflow.com/questions/64033686/how-can-i-use-private-docker-image-in-github-actions
24+
25+
To consider: generate and publish the docker image from a GitHub action.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release - Create checksums and GPG sign
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
gitReleaseTag:
7+
description: 'Release tag to upload to. Must start with "release-"'
8+
type: string
9+
10+
env:
11+
RELEASE_FOLDER: '${{ github.workspace }}/releaseDist'
12+
13+
jobs:
14+
sign_and_checksums:
15+
if: ${{ inputs.gitReleaseTag && startsWith(inputs.gitReleaseTag, 'release-') }}
16+
runs-on: ubuntu-latest
17+
environment: release-env
18+
19+
permissions:
20+
contents: write # So that we can upload to release
21+
22+
steps:
23+
24+
- name: Checkout and setup
25+
uses: actions/checkout@v4
26+
with:
27+
lfs: true
28+
29+
- name: Set up JDK
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: '11'
33+
distribution: 'temurin'
34+
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
35+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
36+
37+
- name: Get all release files
38+
run: |
39+
mkdir -p ${RELEASE_FOLDER}
40+
pushd ${RELEASE_FOLDER}
41+
gh release download ${{ inputs.gitReleaseTag }} -p "*.zip" -p "*.tgz" -p "*.jar" --repo=${{ github.repository }}
42+
popd
43+
env:
44+
GH_TOKEN: ${{ github.token }}
45+
46+
- name: Checksums and sign
47+
run: |
48+
source icu4j/releases_tools/shared.sh
49+
# Convert 76.1 to 76_1
50+
underscore_version=$(echo $artifact_version | sed 's/\./_/g')
51+
pushd ${RELEASE_FOLDER}
52+
sha512sum -b icu4c* > SHASUM512.txt
53+
md5sum -b *.jar > icu4j-${artifact_version}.md5
54+
md5sum -b icu4c-*-data-bin-*.zip > icu4c-${underscore_version}-binary.md5
55+
md5sum -b icu4c-*-src.* > icu4c-${underscore_version}-sources.md5
56+
find . -type f -name 'icu4c*' -exec gpg --no-tty --batch --pinentry-mode loopback --passphrase=$MAVEN_GPG_PASSPHRASE -a --output {}.asc --detach-sig {} \;
57+
gpg --no-tty --batch --pinentry-mode loopback --passphrase=$MAVEN_GPG_PASSPHRASE -a --output SHASUM512.txt.asc --detach-sig SHASUM512.txt
58+
popd
59+
env:
60+
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
61+
62+
- name: Upload to release
63+
run: |
64+
gh release upload ${{ inputs.gitReleaseTag }} LICENSE --clobber --repo=${{ github.repository }}
65+
gh release upload ${{ inputs.gitReleaseTag }} ${RELEASE_FOLDER}/*.md5 --clobber --repo=${{ github.repository }}
66+
gh release upload ${{ inputs.gitReleaseTag }} ${RELEASE_FOLDER}/*.asc --clobber --repo=${{ github.repository }}
67+
gh release upload ${{ inputs.gitReleaseTag }} ${RELEASE_FOLDER}/SHASUM512.txt --clobber --repo=${{ github.repository }}
68+
env:
69+
GH_TOKEN: ${{ github.token }}
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release - ICU4C artifacts on Fedora
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
runTests:
7+
description: 'Run the tests.'
8+
type: boolean
9+
default: true
10+
gitReleaseTag:
11+
description: 'Release tag to upload to. Must start with "release-"'
12+
type: string
13+
14+
env:
15+
RELEASE_FOLDER: '${{ github.workspace }}/releaseDist'
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
environment: release-env
21+
22+
container:
23+
image: ghcr.io/${{ github.repository_owner }}/fedora-docker-gcr:latest
24+
credentials:
25+
username: ${{ secrets.DOCKER_CONTAINER_USER_NAME }}
26+
password: ${{ secrets.DOCKER_CONTAINER_REGISTRY_TOKEN }}
27+
28+
permissions:
29+
contents: write # So that we can upload to release
30+
31+
steps:
32+
33+
- name: Install gh (GitHub CLI)
34+
run: |
35+
# Don't install it in the docker image, get the latest (pros and cons)
36+
dnf install -y gh
37+
38+
- name: Checkout and setup
39+
uses: actions/checkout@v4
40+
with:
41+
lfs: true
42+
43+
- name: Config and build ICU4C proper
44+
run: |
45+
pushd icu4c/source
46+
./runConfigureICU Linux/gcc
47+
make -j8
48+
popd
49+
50+
- name: Run tests
51+
if: ${{ inputs.runTests }}
52+
run: |
53+
pushd icu4c/source
54+
make check
55+
popd
56+
57+
- name: Build release ICU4C
58+
run: |
59+
pushd icu4c/source
60+
make DESTDIR=${RELEASE_FOLDER}/icu releaseDist
61+
popd
62+
63+
- name: Collect artifacts in one folder
64+
run: |
65+
# Get the OS version in VERSION_ID
66+
source /etc/os-release
67+
# Get the ICU version in artifact_version
68+
source icu4j/releases_tools/shared.sh
69+
# Convert 76.1 to 76_1
70+
underscore_version=$(echo $artifact_version | sed 's/\./_/g')
71+
pushd ${RELEASE_FOLDER}
72+
tar -czf icu4c-${underscore_version}-Fedora_Linux${VERSION_ID}-x64.tgz icu
73+
rm -fr icu
74+
popd
75+
76+
- name: Upload build results
77+
uses: actions/[email protected]
78+
with:
79+
name: icu4c-fedora-binaries
80+
path: ${{ env.RELEASE_FOLDER }}
81+
retention-days: 3 # TBD if we want to keep them longer
82+
overwrite: true
83+
84+
- name: Upload to release
85+
if: ${{ inputs.gitReleaseTag && startsWith(inputs.gitReleaseTag, 'release-') }}
86+
run: |
87+
gh release upload ${{ inputs.gitReleaseTag }} ${RELEASE_FOLDER}/* --clobber --repo=${{ github.repository }}
88+
env:
89+
GH_TOKEN: ${{ github.token }}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Release - ICU4C artifacts on Ubuntu
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
runTests:
7+
description: 'Run the tests.'
8+
type: boolean
9+
default: true
10+
gitReleaseTag:
11+
description: 'Release tag to upload to. Must start with "release-"'
12+
type: string
13+
14+
env:
15+
RELEASE_FOLDER: '${{ github.workspace }}/releaseDist'
16+
17+
jobs:
18+
build:
19+
runs-on: ubuntu-latest
20+
environment: release-env
21+
22+
permissions:
23+
contents: write # So that we can upload to release
24+
25+
steps:
26+
27+
- name: Install doxygen
28+
run: |
29+
sudo apt-get -y install doxygen
30+
31+
- name: Checkout and setup
32+
uses: actions/checkout@v4
33+
with:
34+
lfs: true
35+
36+
- name: Config and build ICU4C proper
37+
run: |
38+
pushd icu4c/source
39+
./runConfigureICU Linux/gcc
40+
make -j8
41+
popd
42+
43+
- name: Run tests
44+
if: ${{ inputs.runTests }}
45+
run: |
46+
pushd icu4c/source
47+
make check
48+
popd
49+
50+
- name: Build release ICU4C
51+
run: |
52+
pushd icu4c/source
53+
make dist
54+
make DESTDIR=${RELEASE_FOLDER}/icu releaseDist
55+
popd
56+
57+
- name: Collect artifacts in one folder
58+
run: |
59+
# Get the OS version in VERSION_ID
60+
source /etc/os-release
61+
# Get the ICU version in artifact_version
62+
source icu4j/releases_tools/shared.sh
63+
# Convert 76.1 to 76_1
64+
underscore_version=$(echo $artifact_version | sed 's/\./_/g')
65+
pushd ${RELEASE_FOLDER}
66+
tar -czf icu4c-${underscore_version}-Ubuntu${VERSION_ID}-x64.tgz icu
67+
rm -fr icu
68+
popd
69+
mv icu4c/source/dist/icu4c-76_1-d* ${RELEASE_FOLDER}
70+
mv icu4c/source/dist/icu4c-76_1-src.* ${RELEASE_FOLDER}
71+
72+
- name: Upload build results
73+
uses: actions/[email protected]
74+
with:
75+
name: icu4c-ubuntu-binaries
76+
path: ${{ env.RELEASE_FOLDER }}
77+
retention-days: 3 # TBD if we want to keep them longer
78+
overwrite: true
79+
80+
- name: Upload to release
81+
if: ${{ inputs.gitReleaseTag && startsWith(inputs.gitReleaseTag, 'release-') }}
82+
run: |
83+
gh release upload ${{ inputs.gitReleaseTag }} ${RELEASE_FOLDER}/* --clobber --repo=${{ github.repository }}
84+
env:
85+
GH_TOKEN: ${{ github.token }}

.github/workflows/release-icu4j-maven.yml

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
22
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
33

4-
name: Publish to Nexus Sonatype OSS
4+
name: Release - ICU4J publish to Maven Central
55

66
# For this to run you should define the follwing GitHub Secrets in the proper Environment.
77
# In Settings -- Environments -- release_env -- Environment secrets:
@@ -21,24 +21,29 @@ on:
2121
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow
2222
workflow_dispatch:
2323
inputs:
24-
gitTag:
25-
# TODO: make this mandatory and validate that it is in a release* branch and looks like
26-
# 'release-\d+.\d+ or something like that.
27-
# For now we don't do it so that we can test.
28-
description: 'Git tag at which to sync for deploy and release'
24+
runTests:
25+
description: 'Run the tests.'
26+
type: boolean
27+
default: true
28+
deployToMaven:
29+
description: 'Deploy to Maven Central (using Sonatype OSSRH)'
30+
type: boolean
31+
default: false
32+
gitReleaseTag:
33+
description: 'Release tag to upload to. Must start with "release-"'
2934
type: string
3035

3136
env:
3237
SHARED_MVN_ARGS: '--no-transfer-progress --show-version --batch-mode'
33-
RELEASE_FOLDER: 'target/release_files'
38+
RELEASE_FOLDER: '${{ github.workspace }}/releaseDist'
3439

3540
jobs:
3641
publish:
3742
runs-on: ubuntu-latest
3843
environment: release-env
44+
3945
permissions:
40-
contents: read
41-
packages: write
46+
contents: write # So that we can upload to release
4247

4348
steps:
4449

@@ -59,8 +64,11 @@ jobs:
5964
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
6065
settings-path: ${{ github.workspace }} # location for the settings.xml file
6166

62-
# TODO: enable tests? We don't want to release until we are 100% sure everything works.
63-
- name: Build all of ICU
67+
- name: Run tests
68+
if: ${{ inputs.runTests }}
69+
run: mvn install --file icu4j ${SHARED_MVN_ARGS} --errors --fail-at-end
70+
71+
- name: Build javadoc taglets
6472
run: |
6573
# Really important to do this first because we need `tools/build` for the javadoc applets
6674
mvn install --file icu4j/tools/build \
@@ -69,8 +77,15 @@ jobs:
6977
7078
- name: Build and deploy to Maven Central
7179
run: |
80+
if [ "${{ inputs.deployToMaven }}" != "true" ]; then
81+
echo Deploy to local folder
82+
# Run the deploy, but do it to a local folder, not to Sonatype / Maven Central
83+
export MAVEN_LOCAL='-DaltDeploymentRepository=tempid::file:./local-deploy-folder'
84+
else
85+
echo Deploy to Maven Central using Sonatype OSSRH
86+
fi
7287
mvn deploy --file icu4j \
73-
${SHARED_MVN_ARGS} \
88+
${SHARED_MVN_ARGS} ${MAVEN_LOCAL} \
7489
--settings $GITHUB_WORKSPACE/settings.xml \
7590
--errors --fail-at-end -DdeployAtEnd=true \
7691
-DskipTests -DskipITs \
@@ -97,19 +112,22 @@ jobs:
97112
${SHARED_MVN_ARGS} \
98113
-DskipITs -DskipTests \
99114
-P with_full_javadoc
115+
# Archive the full doc in a jar. Should also be posted to the web as official doc.
100116
jar -Mcf ${RELEASE_FOLDER}/icu4j-${ICU_VERSION}-fulljavadoc.jar \
101117
-C target/site/apidocs/ .
102-
# Create the file with MD5 checksums
103-
pushd ${RELEASE_FOLDER}
104-
md5sum *.jar > icu4j-${ICU_VERSION}.md5
105-
popd # out of $RELEASE_FOLDER
106118
popd # out of icu4j
107119
108-
# TODO: add them to the GitHub "Release" page automatically
109120
- name: Upload build results
110121
uses: actions/[email protected]
111122
with:
112-
path: ./icu4j/${{ env.RELEASE_FOLDER }}/*
123+
name: icu4j-binaries
124+
path: ${{ env.RELEASE_FOLDER }}
113125
retention-days: 3 # TBD if we want to keep them longer
114126
overwrite: true
115127

128+
- name: Upload to release
129+
if: ${{ inputs.gitReleaseTag && startsWith(inputs.gitReleaseTag, 'release-') }}
130+
run: |
131+
gh release upload ${{ inputs.gitReleaseTag }} ${RELEASE_FOLDER}/* --clobber --repo=${{ github.repository }}
132+
env:
133+
GH_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)