-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (60 loc) · 2.03 KB
/
build-and-push.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
61
62
name: On Code Change
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
- "jdk-.*"
jobs:
build:
strategy:
matrix:
jdk_version: ["cimg/openjdk:11.0.20-node", "cimg/openjdk:17.0.9-node"]
name: Buid and push Docker Images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Creating tag from CircleCI image
shell: bash
run: |
echo "CCI_SRC_IMAGE=${{ matrix.jdk_version }}" >> $GITHUB_ENV
echo "JAHIA_TAG=$(echo ${{ matrix.jdk_version }} | sed -r 's/[:\/]+/_/g')" >> $GITHUB_ENV
echo "FROM_IMAGE=jahia/cimg-mvn-cache:$(echo ${{ matrix.jdk_version }} | sed -r 's/[:\/]+/_/g')" >> $GITHUB_ENV
- name: Printing CircleCI image tags
shell: bash
run: |
echo "CCI_SRC_IMAGE=${CCI_SRC_IMAGE}"
echo "JAHIA_TAG=${JAHIA_TAG}"
echo "FROM_IMAGE=${FROM_IMAGE}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: webfactory/ssh-agent@v0.7.0
with:
ssh-private-key: |
${{ secrets.BASTION_SSH_PRIVATE_KEY_JAHIACI }}
${{ secrets.GH_SSH_PRIVATE_KEY_JAHIACI }}
- name: Build and push CircleCI Docker image
uses: docker/build-push-action@v3
with:
ssh: default
push: true
tags: jahia/cimg-mvn-cache:${{ env.JAHIA_TAG }}
build-args: |
CCI_SRC_IMAGE=${{ env.CCI_SRC_IMAGE }}
- name: Build and push Github Actions Docker image
uses: docker/build-push-action@v3
with:
ssh: default
push: true
tags: jahia/cimg-mvn-cache:ga_${{ env.JAHIA_TAG }}
file: Dockerfile-github
build-args: |
FROM_IMAGE=${{ env.FROM_IMAGE }}
CCI_SRC_IMAGE=${{ env.CCI_SRC_IMAGE }}