-
Notifications
You must be signed in to change notification settings - Fork 1
60 lines (51 loc) · 2.66 KB
/
build-node20-jdk11.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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}"