This repository has been archived by the owner on Jul 4, 2024. It is now read-only.
forked from tmforum-oda/oda-canvas
-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (61 loc) · 2.79 KB
/
build-prerelease-secretsmanagement-sidecar.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
63
64
65
66
67
68
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 }}