Skip to content

Commit

Permalink
Update JDK and Maven versions
Browse files Browse the repository at this point in the history
  • Loading branch information
danbao committed Nov 14, 2024
1 parent fc9c2e1 commit cf1279c
Show file tree
Hide file tree
Showing 10 changed files with 159 additions and 207 deletions.
151 changes: 151 additions & 0 deletions .github/workflows/build-maven.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: Build Maven Images

on:
push:
branches:
- master
paths:
- 'jdk*/*'
- '.github/workflows/build-maven.yml'

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
jdk_version: [8, 11, 17, 21]
fail-fast: false

steps:
- uses: actions/checkout@v4

- name: Docker login
env:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo $DOCKER_HUB_PASSWORD | docker login --username $DOCKER_HUB_USERNAME --password-stdin
echo $GITHUB_TOKEN | docker login ghcr.io --username $GITHUB_ACTOR --password-stdin
- name: Set Environment Variables
id: vars
run: |
JDK_DIR=jdk${{ matrix.jdk_version }}
if [[ -f ${JDK_DIR}/Dockerfile ]]; then
VERSION="$(awk -F= '/MAVEN_VERSION=/ {print $2}' ${JDK_DIR}/Dockerfile | cut -d " " -f 1)"
JAVA_VERSION="jdk$(awk -F '[:-]' '/FROM/ {print $2}' ${JDK_DIR}/Dockerfile)"
BASE_VERSION="jdk$(awk -F '[:]' '/FROM/ {print $2}' ${JDK_DIR}/Dockerfile)"
echo "${VERSION}" > ${JDK_DIR}/version.txt
echo "${VERSION}-${BASE_VERSION}" > ${JDK_DIR}/detail_version.txt
fi
echo "JDK_DIR=${JDK_DIR}" >> $GITHUB_ENV
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "JAVA_VERSION=${JAVA_VERSION}" >> $GITHUB_ENV
echo "BASE_VERSION=${BASE_VERSION}" >> $GITHUB_ENV
- name: Build Docker Image
run: |
IMAGE_NAME=ringcentral/maven
docker build --tag ${IMAGE_NAME} --file ${JDK_DIR}/Dockerfile .
- name: Tag and Push Docker Images
run: |
IMAGE_NAME=ringcentral/maven
GH_DOCKER_PKG_IMAGE_NAME=ghcr.io/ringcentral-docker/maven/maven
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:latest"
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${VERSION}"
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${VERSION}-${JAVA_VERSION}"
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${VERSION}-${BASE_VERSION}"
docker push "${IMAGE_NAME}:${VERSION}-${BASE_VERSION}"
docker push "${IMAGE_NAME}:${VERSION}-${JAVA_VERSION}"
docker push "${IMAGE_NAME}:${VERSION}"
docker push "${IMAGE_NAME}:latest"
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:latest"
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:${VERSION}"
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:${VERSION}-${JAVA_VERSION}"
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:${VERSION}-${BASE_VERSION}"
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:${VERSION}-${BASE_VERSION}"
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:${VERSION}-${JAVA_VERSION}"
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:${VERSION}"
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:latest"
if [ "${{ matrix.jdk_version }}" -eq 21 ]; then
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:latest"
docker push "${IMAGE_NAME}:latest"
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:latest"
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:latest"
fi
- name: Generate README Update
run: |
BASE_IMAGE="alpine"
IMAGE_NAME=ringcentral/maven
GH_DOCKER_PKG_IMAGE_NAME=ghcr.io/ringcentral-docker/maven/maven
NEW_ENTRY="| JDK${{ matrix.jdk_version }} | ${VERSION} | \`${IMAGE_NAME}:${VERSION}\` \`${IMAGE_NAME}:${VERSION}-${BASE_IMAGE}\` \`${IMAGE_NAME}:${DETAIL_VERSION}\` \`${IMAGE_NAME}:${DETAIL_VERSION}-${BASE_IMAGE}\` | \`${GH_DOCKER_PKG_IMAGE_NAME}:${VERSION}\` \`${GH_DOCKER_PKG_IMAGE_NAME}:${VERSION}-${BASE_IMAGE}\` \`${GH_DOCKER_PKG_IMAGE_NAME}:${DETAIL_VERSION}\` \`${GH_DOCKER_PKG_IMAGE_NAME}:${DETAIL_VERSION}-${BASE_IMAGE}\` |"
echo "${NEW_ENTRY}" > readme_updates_${{ matrix.jdk_version }}.txt
- name: Upload README Update
uses: actions/upload-artifact@v4
with:
name: readme-updates-${{ matrix.jdk_version }}
path: readme_updates_${{ matrix.jdk_version }}.txt

update-readme:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download README Updates
uses: actions/download-artifact@v4
with:
name: readme-updates-8
path: ./readme-updates
- name: Download README Updates
uses: actions/download-artifact@v4
with:
name: readme-updates-11
path: ./readme-updates
- name: Download README Updates
uses: actions/download-artifact@v4
with:
name: readme-updates-17
path: ./readme-updates
- name: Download README Updates
uses: actions/download-artifact@v4
with:
name: readme-updates-21
path: ./readme-updates

- name: Initialize README
run: |
echo "| JDK Version | Version | Docker Hub | GitHub Package |" > README.md
echo "|-------------|---------|------------|----------------|" >> README.md
- name: Update README
run: |
for file in ./readme-updates/readme_updates_*.txt; do
while IFS= read -r line; do
JDK_VERSION=$(echo $line | cut -d' ' -f2)
if grep -q "JDK${JDK_VERSION}" README.md; then
sed -i "/JDK${JDK_VERSION}/c\\$line" README.md
else
echo "$line" >> README.md
fi
done < "$file"
done
- name: Commit README Update
run: |
git config --global user.name 'john.lin'
git config --global user.email '[email protected]'
git add README.md
git commit -m "Update README with Docker image info"
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48 changes: 0 additions & 48 deletions .github/workflows/maven-base-on-jdk11.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/maven-base-on-jdk17.yml

This file was deleted.

48 changes: 0 additions & 48 deletions .github/workflows/maven-base-on-jdk21.yml

This file was deleted.

56 changes: 0 additions & 56 deletions .github/workflows/maven-base-on-jdk8.yml

This file was deleted.

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
readme-updates
4 changes: 2 additions & 2 deletions jdk11/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ringcentral/jdk:11.0.22-alpine
FROM ringcentral/jdk:11.0.25-alpine
LABEL maintainer="[email protected]"

ENV MAVEN_VERSION=3.8.8 \
ENV MAVEN_VERSION=3.9.9 \
MAVEN_HOME=/usr/share/maven \
MAVEN_CONFIG="$USER_HOME_DIR/.m2" \
MAVEN_BASE_URL=https://downloads.apache.org/maven/maven-3
Expand Down
4 changes: 2 additions & 2 deletions jdk17/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ringcentral/jdk:17.0.10-alpine
FROM ringcentral/jdk:17.0.13-alpine
LABEL maintainer="[email protected]"

ENV MAVEN_VERSION=3.8.8 \
ENV MAVEN_VERSION=3.9.9 \
MAVEN_HOME=/usr/share/maven \
MAVEN_CONFIG="$USER_HOME_DIR/.m2" \
MAVEN_BASE_URL=https://downloads.apache.org/maven/maven-3
Expand Down
4 changes: 2 additions & 2 deletions jdk21/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
FROM ringcentral/jdk:21.0.2-alpine
FROM ringcentral/jdk:21.0.5-alpine
LABEL maintainer="[email protected]"

ENV MAVEN_VERSION=3.8.8 \
ENV MAVEN_VERSION=3.9.9 \
MAVEN_HOME=/usr/share/maven \
MAVEN_CONFIG="$USER_HOME_DIR/.m2" \
MAVEN_BASE_URL=https://downloads.apache.org/maven/maven-3
Expand Down
2 changes: 1 addition & 1 deletion jdk8/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ringcentral/jdk:8u402-alpine
FROM ringcentral/jdk:8u432-alpine
LABEL maintainer="[email protected]"

ENV MAVEN_VERSION=3.8.8 \
Expand Down

0 comments on commit cf1279c

Please sign in to comment.