Skip to content

Commit

Permalink
Add Maven fetch and autobump latest versions feature
Browse files Browse the repository at this point in the history
  • Loading branch information
hbenali committed Nov 11, 2024
1 parent 63b5a99 commit 9336a12
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 34 deletions.
50 changes: 25 additions & 25 deletions .github/table-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,31 @@
| exoplatform/ci:jdk8-gradle6-android | ${JDK8_VERSION} | 2.7 & 3 | 5.4 | Gradle 6.1 / Android 23/24/25/26/27 | [goss.yaml](gradle/jdk8-gradle6-android/tests/goss.yaml) |
| exoplatform/ci:jdk17-gradle8 | ${JDK17_VERSION} | 2.7 & 3 | 11.4 | Gradle 8.7 | [goss.yaml](jdk/jdk17-gradle8/tests/goss.yaml) |
| exoplatform/ci:jdk17-gradle8-android | ${JDK17_VERSION} | 2.7 & 3 | 11.4 | Gradle 8.7 / Android 23/24/25/26/27/28/29/33 | [goss.yaml](gradle/jdk17-gradle8-android/tests/goss.yaml) |
| exoplatform/ci:jdk6-maven30 | 1.6.0_45 | 2.7 & 3 | 5.4 | Maven 3.0.5 | [goss.yaml](maven/jdk6-maven30/tests/goss.yaml) |
| exoplatform/ci:jdk6-maven32 | 1.6.0_45 | 2.7 & 3 | 5.4 | Maven 3.2.5 | [goss.yaml](maven/jdk6-maven32/tests/goss.yaml) |
| exoplatform/ci:jdk7-maven30 | 1.7.0_80 | 2.7 & 3 | 5.4 | Maven 3.0.5 | [goss.yaml](maven/jdk7-maven30/tests/goss.yaml) |
| exoplatform/ci:jdk7-maven32 | 1.7.0_80 | 2.7 & 3 | 5.4 | Maven 3.2.5 | [goss.yaml](maven/jdk7-maven32/tests/goss.yaml) |
| exoplatform/ci:jdk8-maven30 | ${JDK8_VERSION} | 2.7 & 3 | 5.4 | Maven 3.0.5 | [goss.yaml](maven/jdk8-maven30/tests/goss.yaml) |
| exoplatform/ci:jdk8-maven32 | ${JDK8_VERSION} | 2.7 & 3 | 5.4 | Maven 3.2.5 | [goss.yaml](maven/jdk8-maven32/tests/goss.yaml) |
| exoplatform/ci:jdk8-maven33 | ${JDK8_VERSION} | 2.7 & 3 | 5.4 | Maven 3.3.9 | [goss.yaml](maven/jdk8-maven33/tests/goss.yaml) |
| exoplatform/ci:jdk8-maven35 | ${JDK8_VERSION} | 2.7 & 3 | 5.4 | Maven 3.5.4 | [goss.yaml](maven/jdk8-maven35/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven32 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven 3.2.5 | [goss.yaml](maven/jdk11-maven32/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven33 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven 3.3.9 | [goss.yaml](maven/jdk11-maven33/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven35 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven 3.5.4 | [goss.yaml](maven/jdk11-maven35/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven36 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven 3.6.3 | [goss.yaml](maven/jdk11-maven36/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven38 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven 3.8.8 | [goss.yaml](maven/jdk11-maven38/tests/goss.yaml) |
| exoplatform/ci:jdk6-maven30 | 1.6.0_45 | 2.7 & 3 | 5.4 | Maven ${MVN30_VERSION} | [goss.yaml](maven/jdk6-maven30/tests/goss.yaml) |
| exoplatform/ci:jdk6-maven32 | 1.6.0_45 | 2.7 & 3 | 5.4 | Maven ${MVN32_VERSION} | [goss.yaml](maven/jdk6-maven32/tests/goss.yaml) |
| exoplatform/ci:jdk7-maven30 | 1.7.0_80 | 2.7 & 3 | 5.4 | Maven ${MVN30_VERSION} | [goss.yaml](maven/jdk7-maven30/tests/goss.yaml) |
| exoplatform/ci:jdk7-maven32 | 1.7.0_80 | 2.7 & 3 | 5.4 | Maven ${MVN32_VERSION} | [goss.yaml](maven/jdk7-maven32/tests/goss.yaml) |
| exoplatform/ci:jdk8-maven30 | ${JDK8_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN30_VERSION} | [goss.yaml](maven/jdk8-maven30/tests/goss.yaml) |
| exoplatform/ci:jdk8-maven32 | ${JDK8_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN32_VERSION} | [goss.yaml](maven/jdk8-maven32/tests/goss.yaml) |
| exoplatform/ci:jdk8-maven33 | ${JDK8_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN33_VERSION} | [goss.yaml](maven/jdk8-maven33/tests/goss.yaml) |
| exoplatform/ci:jdk8-maven35 | ${JDK8_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN35_VERSION} | [goss.yaml](maven/jdk8-maven35/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven32 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN32_VERSION} | [goss.yaml](maven/jdk11-maven32/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven33 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN33_VERSION} | [goss.yaml](maven/jdk11-maven33/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven35 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN35_VERSION} | [goss.yaml](maven/jdk11-maven35/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven36 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN36_VERSION} | [goss.yaml](maven/jdk11-maven36/tests/goss.yaml) |
| exoplatform/ci:jdk11-maven38 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN38_VERSION} | [goss.yaml](maven/jdk11-maven38/tests/goss.yaml) |
| exoplatform/ci:jdk11-mavend08 | ${JDK11_VERSION} | 2.7 & 3 | 5.4 | Mavend 0.8.2 | [goss.yaml](mavend/jdk11-mavend08/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven36 | ${JDK17_VERSION} | 2.7 & 3 | 5.4 | Maven 3.6.3 | [goss.yaml](maven/jdk17-maven36/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven38 | ${JDK17_VERSION} | 2.7 & 3 | 5.4 | Maven 3.8.8 | [goss.yaml](maven/jdk17-maven38/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven36 | ${JDK17_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN36_VERSION} | [goss.yaml](maven/jdk17-maven36/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven38 | ${JDK17_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN38_VERSION} | [goss.yaml](maven/jdk17-maven38/tests/goss.yaml) |
| exoplatform/ci:jdk17-mavend08 | ${JDK17_VERSION} | 2.7 & 3 | 5.4 | Mavend 0.8.2 | [goss.yaml](mavend/jdk17-mavend08/tests/goss.yaml) |
| exoplatform/ci:jdk17-mavend09 | ${JDK17_VERSION} | 2.7 & 3 | 5.4 | Mavend 0.9.0 | [goss.yaml](mavend/jdk17-mavend09/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39 | ${JDK17_VERSION} | 2.7 & 3 | 5.4 | Maven 3.9.9 | [goss.yaml](maven/jdk17-maven39/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39-alpine | ${JDK17_VERSION} | 2.7 & 3 | 13.2 | Maven 3.9.9 | [goss.yaml](maven/jdk17-maven39-alpine/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39-ubuntu20 | ${JDK17_VERSION} | 2.7 & 3 | 9.4 | Maven 3.9.9 | [goss.yaml](maven/jdk17-maven39-ubuntu20/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39-ubuntu22 | ${JDK17_VERSION} | 2.7 & 3 | 11.4 | Maven 3.9.9 | [goss.yaml](maven/jdk17-maven39-ubuntu22/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39-ubuntu24 | ${JDK17_VERSION} | 3 | 13.2 | Maven 3.9.9 | [goss.yaml](maven/jdk17-maven39-ubuntu24/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven40-ubuntu22 | ${JDK17_VERSION} | 2.7 & 3 | 11.4 | Maven 4.0.0 (beta) | [goss.yaml](maven/jdk17-maven40-ubuntu22/tests/goss.yaml) |
| exoplatform/ci:jdk21-maven39-ubuntu20 | ${JDK21_VERSION} | 2.7 & 3 | 9.4 | Maven 3.9.9 | [goss.yaml](maven/jdk21-maven39-ubuntu20/tests/goss.yaml) |
| exoplatform/ci:jdk21-maven39-ubuntu22 | ${JDK21_VERSION} | 2.7 & 3 | 11.4 | Maven 3.9.9 | [goss.yaml](maven/jdk21-maven39-ubuntu22/tests/goss.yaml) |
| exoplatform/ci:jdk21-maven39-ubuntu24 | ${JDK21_VERSION} | 3 | 13.2 | Maven 3.9.9 | [goss.yaml](maven/jdk21-maven39-ubuntu24/tests/goss.yaml) |
| exoplatform/ci:jdk21-maven40-ubuntu22 | ${JDK21_VERSION} | 2.7 & 3 | 11.4 | Maven 4.0.0 (beta) | [goss.yaml](maven/jdk21-maven40-ubuntu22/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39 | ${JDK17_VERSION} | 2.7 & 3 | 5.4 | Maven ${MVN39_VERSION} | [goss.yaml](maven/jdk17-maven39/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39-alpine | ${JDK17_VERSION} | 2.7 & 3 | 13.2 | Maven ${MVN39_VERSION} | [goss.yaml](maven/jdk17-maven39-alpine/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39-ubuntu20 | ${JDK17_VERSION} | 2.7 & 3 | 9.4 | Maven ${MVN39_VERSION} | [goss.yaml](maven/jdk17-maven39-ubuntu20/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39-ubuntu22 | ${JDK17_VERSION} | 2.7 & 3 | 11.4 | Maven ${MVN39_VERSION} | [goss.yaml](maven/jdk17-maven39-ubuntu22/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven39-ubuntu24 | ${JDK17_VERSION} | 3 | 13.2 | Maven ${MVN39_VERSION} | [goss.yaml](maven/jdk17-maven39-ubuntu24/tests/goss.yaml) |
| exoplatform/ci:jdk17-maven40-ubuntu22 | ${JDK17_VERSION} | 2.7 & 3 | 11.4 | Maven ${MVN40_VERSION} | [goss.yaml](maven/jdk17-maven40-ubuntu22/tests/goss.yaml) |
| exoplatform/ci:jdk21-maven39-ubuntu20 | ${JDK21_VERSION} | 2.7 & 3 | 9.4 | Maven ${MVN39_VERSION} | [goss.yaml](maven/jdk21-maven39-ubuntu20/tests/goss.yaml) |
| exoplatform/ci:jdk21-maven39-ubuntu22 | ${JDK21_VERSION} | 2.7 & 3 | 11.4 | Maven ${MVN39_VERSION} | [goss.yaml](maven/jdk21-maven39-ubuntu22/tests/goss.yaml) |
| exoplatform/ci:jdk21-maven39-ubuntu24 | ${JDK21_VERSION} | 3 | 13.2 | Maven ${MVN39_VERSION} | [goss.yaml](maven/jdk21-maven39-ubuntu24/tests/goss.yaml) |
| exoplatform/ci:jdk21-maven40-ubuntu22 | ${JDK21_VERSION} | 2.7 & 3 | 11.4 | Maven ${MVN40_VERSION} | [goss.yaml](maven/jdk21-maven40-ubuntu22/tests/goss.yaml) |
54 changes: 45 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ 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:
Expand All @@ -20,8 +23,35 @@ jobs:
echo " - JDK ${paddingspace}${major_jdk_version}: $(echo ${latestversion} | sed 's/,/./g')" >> $GITHUB_STEP_SUMMARY
done
echo "Done"
env:
jdk_list: 8,11,17,21
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 "[email protected]"
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"
Expand Down Expand Up @@ -98,7 +128,7 @@ jobs:

build-maven-images:
name: "Build Maven Images"
needs: build-jdk-images
needs: [check-autobump-available-maven, build-jdk-images]
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -244,16 +274,16 @@ jobs:
DOCKER_PRIVATE_KEY: ${{ secrets.DOCKER_PRIVATE_KEY }}
DOCKER_PRIVATE_KEY_PASSPHRASE: ${{ secrets.DOCKER_PRIVATE_KEY_PASSPHRASE }}

update-zulu-jdks-readme:
name: "Update Readme file jdk section"
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 }}
- name: Check latest jdk versions
- 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"
Expand All @@ -272,6 +302,14 @@ jobs:
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
Expand All @@ -281,7 +319,5 @@ jobs:
git config --global user.email "[email protected]"
git config --global user.name "eXo Software Factory"
git add README.md
git diff-index --quiet HEAD || git commit -m "Automated JDK versions README update"
git diff-index --quiet HEAD || git commit -m "Automated JDK & Maven versions README update"
git push origin HEAD
env:
jdk_list: 8,11,17,21

0 comments on commit 9336a12

Please sign in to comment.