-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
159 additions
and
207 deletions.
There are no files selected for viewing
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
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 }} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
readme-updates |
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
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 | ||
|
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
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 | ||
|
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
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 | ||
|
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
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 \ | ||
|