This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
Build SecretsManagement-Sidecar Prerelease Dockerimage #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build SecretsManagement-Sidecar Prerelease Dockerimage | |
run-name: Build SecretsManagement-Sidecar Prerelease Dockerimage | |
on: | |
push: | |
branches: | |
- feature/* | |
- odaa-* | |
paths: | |
- source/operators/secretsmanagementOperator-hc/sidecar/docker/**/* | |
jobs: | |
build-secrets-management-sidecar-prerelease-dockerfile-job: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: read image of secretsmanagement-sidecar from values.yaml | |
id: get_smansidecar_image | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq '.secretsmanagement-operator.sidecarImage' charts/canvas-oda/values.yaml | |
- name: read versionnumber of secretsmanagement-sidecar from values.yaml | |
id: get_smansidecar_version | |
uses: mikefarah/yq@master | |
with: | |
cmd: yq '[.secretsmanagement-operator.sidecarVersion, .secretsmanagement-operator.sidecarPrereleaseSuffix] | filter(.!=null and .!="") | join("-")' charts/canvas-oda/values.yaml | |
- name: Check Version | |
id: check-tag | |
run: | | |
echo | |
if [[ ${{ steps.get_smansidecar_version.outputs.result }} =~ ^[0-9]+\.[0-9]+\.[0-9]+-.*$ ]]; then | |
echo "Version ${{ steps.get_smansidecar_version.outputs.result }} matches prerelease format <n>.<n>.<n>-<prerelease>" | |
else | |
echo "::error::Version ${{ steps.get_smansidecar_version.outputs.result }} does not matche prerelease format <n>.<n>.<n>-<prerelease>" && exit 1 | |
fi | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Get Git commit timestamps | |
run: | | |
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV | |
echo "GIT_COMMIT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
echo "CICD_BUILD_TIME=$(date -Iseconds)" >> $GITHUB_ENV | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: source/operators/secretsmanagementOperator-hc/sidecar/docker | |
build-args: | | |
SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }} | |
GIT_COMMIT_SHA=${{ env.GIT_COMMIT_SHA }} | |
CICD_BUILD_TIME=${{ env.CICD_BUILD_TIME }} | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: | | |
${{ steps.get_smansidecar_image.outputs.result }}:latest | |
${{ steps.get_smansidecar_image.outputs.result }}:${{ steps.get_smansidecar_version.outputs.result }} | |
env: | |
SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }} |