Skip to content

Fix the DockerHub image promotion workflow (#298) #2

Fix the DockerHub image promotion workflow (#298)

Fix the DockerHub image promotion workflow (#298) #2

Workflow file for this run

name: Build Release Docker Images
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
build-images:
runs-on: ubuntu-latest
steps:
- name: Checkout Automation Code
uses: actions/checkout@v4
- name: Get Metadata
run: |
echo "VERSION=$(cat VERSION)" >> $GITHUB_ENV
echo "TAG=$(cat VERSION | cut -c 2-)" >> $GITHUB_ENV
echo "ISO8601=$(LC_TIME=en_US.UTF-8 date "+%Y-%m-%dT%H:%M:%S%z")" >> $GITHUB_ENV
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Setup Jfrog
uses: jfrog/setup-jfrog-cli@v3
env:
JF_URL: ${{ secrets.ARTIFACTORY_URL }}
JF_ACCESS_TOKEN: ${{ secrets.ARTIFACTORY_TOKEN }}
- name: Login to JFrog
uses: docker/login-action@v2
with:
registry: aerospike.jfrog.io
username: ${{ secrets.ARTIFACTORY_USER }}
password: ${{ secrets.ARTIFACTORY_TOKEN }}
- name: Build and Push
uses: docker/bake-action@v4
env:
GIT_COMMIT_SHA: ${{ github.sha }}
GIT_BRANCH: ${{ github.ref }}
LATEST: false
TAG: ${{env.TAG}}
VERSION: ${{env.VERSION}}
CONTEXT: ${{ github.workspace }}
ISO8601: ${{env.ISO8601}}
with:
workdir: ${{ github.workspace }}
files: ${{ github.workspace }}/build/docker-build/docker-bake.hcl
targets: default
- name: Promote image with version tag
env:
ARTIFACTORY_CONTAINER_DEV: ${{ vars.ARTIFACTORY_CONTAINER_DEV }}
ARTIFACTORY_CONTAINER_PROD: ${{ vars.ARTIFACTORY_CONTAINER_PROD }}
TAG: ${{env.TAG}}
run: |
jfrog rt docker-promote aerospike-backup-service \
"$ARTIFACTORY_CONTAINER_DEV" \
"$ARTIFACTORY_CONTAINER_PROD" \
--source-tag "$TAG" \
--target-tag "$TAG" \
--user "${{ secrets.ARTIFACTORY_USER }}" \
--password "${{ secrets.ARTIFACTORY_TOKEN }}" \
--url "${{ secrets.ARTIFACTORY_PROMOTE_URL }}" \
--copy
- name: Promote image with latest tag
env:
ARTIFACTORY_CONTAINER_DEV: ${{ vars.ARTIFACTORY_CONTAINER_DEV }}
ARTIFACTORY_CONTAINER_PROD: ${{ vars.ARTIFACTORY_CONTAINER_PROD }}
TAG: ${{env.TAG}}
run: |
jfrog rt docker-promote aerospike-backup-service \
"$ARTIFACTORY_CONTAINER_DEV" \
"$ARTIFACTORY_CONTAINER_PROD" \
--source-tag "$TAG" \
--target-tag "latest" \
--user "${{ secrets.ARTIFACTORY_USER }}" \
--password "${{ secrets.ARTIFACTORY_TOKEN }}" \
--url "${{ secrets.ARTIFACTORY_PROMOTE_URL }}" \
--copy