Build & publish eXo CI images #122
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & publish eXo CI images | |
on: | |
schedule: | |
- cron: '0 22 * * 5' # Every Friday at 10 PM UTC | |
workflow_dispatch: | |
env: | |
jdk_list: 8,11,17,21 | |
mvn_list: 3.0,3.2,3.3,3.5,3.6,3.8,3.9,4.0 | |
jobs: | |
check-available-zulu-jdks: | |
name: Check available Zulu JDKs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check latest jdk versions | |
run: | | |
echo "Fetching latest versions of JDK (${jdk_list}):" | |
echo "### JDK Versions List:" >> $GITHUB_STEP_SUMMARY | |
for major_jdk_version in ${jdk_list//,/ }; do | |
latestversion=$(curl -fsSL -X GET "https://api.azul.com/metadata/v1/zulu/packages/?java_version=${major_jdk_version}&os=ubuntu&arch=amd&java_package_type=jdk&javafx_bundled=false&release_status=ga&availability_types=CA&certifications=tck&page=1&page_size=1" -H "accept: application/json" | jq -r '.[].java_version | join(",")') | |
[ ${major_jdk_version} -lt '10' ] && paddingspace=" " || paddingspace= | |
echo " - JDK ${paddingspace}${major_jdk_version}: $(echo ${latestversion} | sed 's/,/./g')" | |
echo " - JDK ${paddingspace}${major_jdk_version}: $(echo ${latestversion} | sed 's/,/./g')" >> $GITHUB_STEP_SUMMARY | |
done | |
echo "Done" | |
check-autobump-available-maven: | |
name: Check and autobump Maven versions | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SWF_TOKEN }} | |
- name: Autobump latest maven versions | |
run: | | |
git config --global user.email "exo-swf@exoplatform.com" | |
git config --global user.name "eXo Software Factory" | |
echo "Fetching latest versions of Maven (${mvn_list}):" | |
echo "### Maven Versions List:" >> $GITHUB_STEP_SUMMARY | |
for major_mvn_version in ${mvn_list//,/ }; do | |
latestversion=$(curl -fsSL -X GET "https://archive.apache.org/dist/maven/maven-${major_mvn_version%%.*}/" | grep -o 'href=".*">' | sed -e "s/href=\"//g" | sed -e 's/">//g' | tail -n +2 | tr -d '/' | grep -P "^${major_mvn_version}" | tail -1) | |
if [ -z "${latestversion}" ]; then | |
echo "Error: Cannot find latest version for Maven ${major_mvn_version}! Abort!" | |
exit 1 | |
fi | |
echo " - Maven ${major_mvn_version}: ${latestversion}" | |
echo " - Maven ${major_mvn_version}: ${latestversion}" >> $GITHUB_STEP_SUMMARY | |
grep -irl "ENV MAVEN_VERSION=${major_mvn_version}" --include=Dockerfile | xargs -r sed -Ei "s/^ENV MAVEN_VERSION=.*/ENV MAVEN_VERSION=${latestversion}/" | |
git add -u | |
git diff-index --quiet HEAD || git commit -m "Autobump maven ${major_mvn_version} to ${latestversion}" | |
done | |
echo "Done" | |
git push origin HEAD | |
build-base-images: | |
name: "Build Base Images" | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- imageTag: base | |
context: base | |
- imageTag: base-alpine | |
context: base-alpine | |
- imageTag: base-ubuntu20 | |
context: base-ubuntu20 | |
- imageTag: base-ubuntu22 | |
context: base-ubuntu22 | |
- imageTag: base-ubuntu24 | |
context: base-ubuntu24 | |
uses: exoplatform/swf-scripts/.github/workflows/buildDockerImage.yml@master | |
with: | |
dockerImage: "exoplatform/ci" | |
dockerImageTag: ${{ matrix.imageTag }} | |
dockerFileContext: ${{ matrix.context }} | |
signImage: false | |
secrets: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_PRIVATE_KEY_ID: ${{ secrets.DOCKER_PRIVATE_KEY_ID }} | |
DOCKER_PRIVATE_KEY: ${{ secrets.DOCKER_PRIVATE_KEY }} | |
DOCKER_PRIVATE_KEY_PASSPHRASE: ${{ secrets.DOCKER_PRIVATE_KEY_PASSPHRASE }} | |
build-jdk-images: | |
name: "Build JDK Images" | |
needs: build-base-images | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- imageTag: jdk6 | |
context: jdk/jdk6 | |
- imageTag: jdk7 | |
context: jdk/jdk7 | |
- imageTag: jdk8 | |
context: jdk/jdk8 | |
- imageTag: jdk11 | |
context: jdk/jdk11 | |
- imageTag: jdk17 | |
context: jdk/jdk17 | |
- imageTag: jdk17-alpine | |
context: jdk/jdk17-alpine | |
- imageTag: jdk17-ubuntu20 | |
context: jdk/jdk17-ubuntu20 | |
- imageTag: jdk17-ubuntu22 | |
context: jdk/jdk17-ubuntu22 | |
- imageTag: jdk17-ubuntu24 | |
context: jdk/jdk17-ubuntu24 | |
- imageTag: jdk21-ubuntu20 | |
context: jdk/jdk21-ubuntu20 | |
- imageTag: jdk21-ubuntu22 | |
context: jdk/jdk21-ubuntu22 | |
- imageTag: jdk21-ubuntu24 | |
context: jdk/jdk21-ubuntu24 | |
uses: exoplatform/swf-scripts/.github/workflows/buildDockerImage.yml@master | |
with: | |
dockerImage: "exoplatform/ci" | |
dockerImageTag: ${{ matrix.imageTag }} | |
dockerFileContext: ${{ matrix.context }} | |
signImage: false | |
secrets: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_PRIVATE_KEY_ID: ${{ secrets.DOCKER_PRIVATE_KEY_ID }} | |
DOCKER_PRIVATE_KEY: ${{ secrets.DOCKER_PRIVATE_KEY }} | |
DOCKER_PRIVATE_KEY_PASSPHRASE: ${{ secrets.DOCKER_PRIVATE_KEY_PASSPHRASE }} | |
build-maven-images: | |
name: "Build Maven Images" | |
needs: [check-autobump-available-maven, build-jdk-images] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- imageTag: jdk6-maven30 | |
context: maven/jdk6-maven30 | |
- imageTag: jdk6-maven32 | |
context: maven/jdk6-maven32 | |
- imageTag: jdk7-maven30 | |
context: maven/jdk7-maven30 | |
- imageTag: jdk7-maven32 | |
context: maven/jdk7-maven32 | |
- imageTag: jdk8-maven30 | |
context: maven/jdk8-maven30 | |
- imageTag: jdk8-maven32 | |
context: maven/jdk8-maven32 | |
- imageTag: jdk8-maven33 | |
context: maven/jdk8-maven33 | |
- imageTag: jdk8-maven35 | |
context: maven/jdk8-maven35 | |
- imageTag: jdk11-maven33 | |
context: maven/jdk11-maven33 | |
- imageTag: jdk11-maven35 | |
context: maven/jdk11-maven35 | |
- imageTag: jdk11-maven36 | |
context: maven/jdk11-maven36 | |
- imageTag: jdk11-maven38 | |
context: maven/jdk11-maven38 | |
- imageTag: jdk17-maven36 | |
context: maven/jdk17-maven36 | |
- imageTag: jdk17-maven38 | |
context: maven/jdk17-maven38 | |
- imageTag: jdk17-maven39 | |
context: maven/jdk17-maven39 | |
- imageTag: jdk17-maven39-alpine | |
context: maven/jdk17-maven39-alpine | |
- imageTag: jdk17-maven39-ubuntu20 | |
context: maven/jdk17-maven39-ubuntu20 | |
- imageTag: jdk17-maven39-ubuntu22 | |
context: maven/jdk17-maven39-ubuntu22 | |
- imageTag: jdk17-maven39-ubuntu24 | |
context: maven/jdk17-maven39-ubuntu24 | |
- imageTag: jdk17-maven40-ubuntu22 | |
context: maven/jdk17-maven40-ubuntu22 | |
- imageTag: jdk21-maven39-ubuntu20 | |
context: maven/jdk21-maven39-ubuntu20 | |
- imageTag: jdk21-maven39-ubuntu20 | |
context: maven/jdk21-maven39-ubuntu20 | |
- imageTag: jdk21-maven39-ubuntu22 | |
context: maven/jdk21-maven39-ubuntu22 | |
- imageTag: jdk21-maven39-ubuntu24 | |
context: maven/jdk21-maven39-ubuntu24 | |
- imageTag: jdk21-maven40-ubuntu22 | |
context: maven/jdk21-maven40-ubuntu22 | |
uses: exoplatform/swf-scripts/.github/workflows/buildDockerImage.yml@master | |
with: | |
dockerImage: "exoplatform/ci" | |
dockerImageTag: ${{ matrix.imageTag }} | |
dockerFileContext: ${{ matrix.context }} | |
signImage: false | |
secrets: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_PRIVATE_KEY_ID: ${{ secrets.DOCKER_PRIVATE_KEY_ID }} | |
DOCKER_PRIVATE_KEY: ${{ secrets.DOCKER_PRIVATE_KEY }} | |
DOCKER_PRIVATE_KEY_PASSPHRASE: ${{ secrets.DOCKER_PRIVATE_KEY_PASSPHRASE }} | |
build-gradle-images: | |
name: "Build Gradle Images" | |
needs: build-jdk-images | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- imageTag: jdk8-gradle4 | |
context: gradle/jdk8-gradle4 | |
- imageTag: jdk8-gradle6 | |
context: gradle/jdk8-gradle6 | |
- imageTag: jdk17-gradle8 | |
context: gradle/jdk17-gradle8 | |
uses: exoplatform/swf-scripts/.github/workflows/buildDockerImage.yml@master | |
with: | |
dockerImage: "exoplatform/ci" | |
dockerImageTag: ${{ matrix.imageTag }} | |
dockerFileContext: ${{ matrix.context }} | |
signImage: false | |
secrets: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_PRIVATE_KEY_ID: ${{ secrets.DOCKER_PRIVATE_KEY_ID }} | |
DOCKER_PRIVATE_KEY: ${{ secrets.DOCKER_PRIVATE_KEY }} | |
DOCKER_PRIVATE_KEY_PASSPHRASE: ${{ secrets.DOCKER_PRIVATE_KEY_PASSPHRASE }} | |
build-gradle-android-images: | |
name: "Build Gradle Android Images" | |
needs: build-gradle-images | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- imageTag: jdk8-gradle4-android | |
context: gradle/jdk8-gradle4-android | |
- imageTag: jdk8-gradle6-android | |
context: gradle/jdk8-gradle6-android | |
- imageTag: jdk17-gradle8-android | |
context: gradle/jdk17-gradle8-android | |
uses: exoplatform/swf-scripts/.github/workflows/buildDockerImage.yml@master | |
with: | |
dockerImage: "exoplatform/ci" | |
dockerImageTag: ${{ matrix.imageTag }} | |
dockerFileContext: ${{ matrix.context }} | |
signImage: false | |
secrets: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_PRIVATE_KEY_ID: ${{ secrets.DOCKER_PRIVATE_KEY_ID }} | |
build-fastlane-android-images: | |
name: "Build Fastlane Android Images" | |
needs: build-gradle-android-images | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# - imageTag: fastlane-gradle6-android | |
# context: android/fastlane-gradle6-android | |
- imageTag: fastlane-gradle8-android | |
context: android/fastlane-gradle8-android | |
uses: exoplatform/swf-scripts/.github/workflows/buildDockerImage.yml@master | |
with: | |
dockerImage: "exoplatform/ci" | |
dockerImageTag: ${{ matrix.imageTag }} | |
dockerFileContext: ${{ matrix.context }} | |
signImage: false | |
secrets: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKER_PRIVATE_KEY_ID: ${{ secrets.DOCKER_PRIVATE_KEY_ID }} | |
DOCKER_PRIVATE_KEY: ${{ secrets.DOCKER_PRIVATE_KEY }} | |
DOCKER_PRIVATE_KEY_PASSPHRASE: ${{ secrets.DOCKER_PRIVATE_KEY_PASSPHRASE }} | |
update-zulu-jdks-and-maven-readme: | |
name: "Update Readme file jdk & Maven section" | |
needs: build-maven-images | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.SWF_TOKEN }} | |
ref: ${{ github.ref }} | |
- name: Check latest jdk & maven versions | |
run: | | |
if ! grep -q '<!-- GHASTART -->' README.md; then | |
echo "Error: Cannot find <!-- GHASTART --> md comment in Readme.md file! Abort" | |
exit 1 | |
fi | |
if ! grep -q '<!-- GHAEND -->' README.md; then | |
echo "Error: Cannot find <!-- GHAEND --> md comment in Readme.md file! Abort" | |
exit 1 | |
fi | |
echo "Fetching latest versions of JDK (${jdk_list}):" | |
for major_jdk_version in ${jdk_list//,/ }; do | |
latestversion=$(curl -fsSL -X GET "https://api.azul.com/metadata/v1/zulu/packages/?java_version=${major_jdk_version}&os=ubuntu&arch=amd&java_package_type=jdk&javafx_bundled=false&release_status=ga&availability_types=CA&certifications=tck&page=1&page_size=1" -H "accept: application/json" | jq -r '.[].java_version | join(",")') | |
if [ -z "${latestversion}" ]; then | |
echo "Error: Cannot find latest version for JDK ${major_jdk_version}! Abort!" | |
exit 1 | |
fi | |
export JDK${major_jdk_version}_VERSION=$(echo ${latestversion} | sed 's/,/./g') | |
done | |
for major_mvn_version in ${mvn_list//,/ }; do | |
latestversion=$(curl -fsSL -X GET "https://archive.apache.org/dist/maven/maven-${major_mvn_version%%.*}/" | grep -o 'href=".*">' | sed -e "s/href=\"//g" | sed -e 's/">//g' | tail -n +2 | tr -d '/' | grep -P "^${major_mvn_version}" | tail -1) | |
if [ -z "${latestversion}" ]; then | |
echo "Error: Cannot find latest version for Maven ${major_mvn_version}! Abort!" | |
exit 1 | |
fi | |
export MVN${major_mvn_version//./}_VERSION=$(echo ${latestversion} | sed 's/,/./g') | |
done | |
perl -pe 's/\$\{([^}]+)\}/$ENV{$1} || ""/ge' .github/table-template.md | column -t -s '|' -o '|' > /tmp/mdtable | |
sed '/<!-- GHASTART -->/q' README.md > /tmp/newreadme | |
cat /tmp/mdtable >> /tmp/newreadme | |
sed -n '/<!-- GHAEND -->/,$p' README.md >> /tmp/newreadme | |
cp -f /tmp/newreadme README.md | |
git status | |
git config --global user.email "exo-swf@exoplatform.com" | |
git config --global user.name "eXo Software Factory" | |
git add README.md | |
git diff-index --quiet HEAD || git commit -m "Automated JDK & Maven versions README update" | |
git push origin HEAD |