Skip to content

#28173 include in 23.01.17 LTS #2296

#28173 include in 23.01.17 LTS

#28173 include in 23.01.17 LTS #2296

name: publish-dotcms-docker-image-on-release
on:
push:
branches:
- release-*
repository_dispatch:
types:
- enterprise-update
jobs:
publish_image:
name: Publish DotCMS docker image on release push
runs-on: ubuntu-latest
steps:
- name: Process Params
run: |
if [[ "${{ github.event_name }}" == 'repository_dispatch' ]]; then
BUILD_ID=${{ github.event.client_payload.build_id }}
else
BUILD_ID=$(basename "${{ github.ref }}")
fi
if [[ -z "${BUILD_ID}" ]]; then
echo 'Could not resolve BUILD_ID, aborting'
exit 1
else
echo "Found BUILD_ID: ${BUILD_ID}"
fi
echo "BUILD_ID=${BUILD_ID}" >> $GITHUB_ENV
- name: Checkout core
uses: actions/checkout@v3
with:
ref: ${{ env.BUILD_ID }}
- name: Set Common Vars
run: |
BUILD_HASH=$(git log -1 --pretty=%h)
eval $(cat dotCMS/gradle.properties| grep dotcmsReleaseVersion)
DOTCMS_VERSION="${dotcmsReleaseVersion}"
if [[ ${BUILD_ID} =~ ^release-[0-9]{2}.[0-9]{2}(.[0-9]{1,2})?$ ]]; then
jobRun=true
else
jobRun=false
fi
echo "BUILD_HASH=${BUILD_HASH}" >> $GITHUB_ENV
echo "DOTCMS_VERSION=${DOTCMS_VERSION}" >> $GITHUB_ENV
echo "jobRun=${jobRun}" >> $GITHUB_ENV
- name: Discover docker tags
id: discover-docker-tags
uses: dotcms/discover-docker-tags-action@v2.0
with:
version: ${{ env.DOTCMS_VERSION }}
hash: ${{ env.BUILD_HASH }}
label: 'SNAPSHOT'
update_stable: false
also_latest: false
image_name: dotcms/dotcms
if: env.jobRun == 'true'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2.1.0
with:
platforms: amd64,arm64
- name: Docker Setup Buildx
uses: docker/setup-buildx-action@v2.2.1
with:
platforms: linux/amd64,linux/arm64
driver-opts: |
image=moby/buildkit:v0.10.6
- name: Docker Hub login
uses: docker/login-action@v2.1.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v3.2.0
with:
context: ./docker/dotcms
push: true
tags: ${{ steps.discover-docker-tags.outputs.discovered_tags }}
platforms: linux/amd64,linux/arm64
build-args: |
BUILD_FROM=COMMIT
BUILD_ID=${{ env.BUILD_ID }}
if: env.jobRun == 'true'