Skip to content

On Code Change

On Code Change #323

name: On Code Change
on:
workflow_dispatch:
schedule:
- cron: "0 0 * * *"
push:
branches:
- main
env:
cci_src_image: cimg/openjdk:8.0.312-node
jobs:
build:
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=${{ env.cci_src_image }}" >> $GITHUB_ENV
echo "JAHIA_TAG=$(echo ${{ env.cci_src_image }} | 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}"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: webfactory/[email protected]
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 }}
- 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