add node 20 #1
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 Node 20 base on JDK 11 | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
# '*' matches any character except '/' | |
- '20-jdk11/*' | |
- '.github/workflows/build-node20-jdk11.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- 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 docker.pkg.github.com --username $GITHUB_ACTOR --password-stdin | |
- name: Build & Push Docker Image | |
run: | | |
cd 20-jdk11 | |
IMAGE_NAME=ringcentral/node | |
GH_DOCKER_PKG_IMAGE_NAME=docker.pkg.github.com/ringcentral-docker/node/node | |
NODE_VERSION="$(awk '/ENV NODE_VERSION/ {print $3}' Dockerfile)" | |
NODE_MAJOR_VERSION="$(awk -F '[ .]' '/ENV NODE_VERSION/ {print $3}' Dockerfile)" | |
BASE_VERSION="$(awk -F '[:-]' '/FROM/ {print $3}' Dockerfile)" | |
docker build --tag ${IMAGE_NAME} --file Dockerfile . | |
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:latest" | |
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${NODE_VERSION}" | |
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${NODE_MAJOR_VERSION}" | |
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${NODE_VERSION}-${BASE_VERSION}" | |
docker tag "${IMAGE_NAME}" "${IMAGE_NAME}:${NODE_MAJOR_VERSION}-${BASE_VERSION}" | |
docker push "${IMAGE_NAME}:latest" | |
docker push "${IMAGE_NAME}:${NODE_VERSION}" | |
docker push "${IMAGE_NAME}:${NODE_MAJOR_VERSION}" | |
docker push "${IMAGE_NAME}:${NODE_VERSION}-${BASE_VERSION}" | |
docker push "${IMAGE_NAME}:${NODE_MAJOR_VERSION}-${BASE_VERSION}" | |
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:latest" | |
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_VERSION}" | |
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_VERSION}-${BASE_VERSION}" | |
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_MAJOR_VERSION}" | |
docker tag "${IMAGE_NAME}" "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_MAJOR_VERSION}-${BASE_VERSION}" | |
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:latest" | |
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_VERSION}" | |
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_MAJOR_VERSION}" | |
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_VERSION}-${BASE_VERSION}" | |
docker push "${GH_DOCKER_PKG_IMAGE_NAME}:${NODE_MAJOR_VERSION}-${BASE_VERSION}" |