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
84 lines (76 loc) · 3.47 KB
/
build-release-secretsmanagement-operator.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Build SecretsManagement-Operator Release Dockerimage
run-name: Build SecretsManagement-Operator Release Dockerimage
on:
push:
branches:
# TODO[FH]: remove testmain
- testmain
- master
paths:
- source/operators/secretsmanagementOperator-hc/docker/**/*
jobs:
build-secrets-management-operator-release-dockerfile-job:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: read image of secretsmanagement-operator from values.yaml
id: get_smanop_image
uses: mikefarah/yq@master
with:
cmd: yq '.secretsmanagement-operator.image' charts/canvas-oda/values.yaml
- name: read versionnumber of secretsmanagement-operator from values.yaml
id: get_smanop_version
uses: mikefarah/yq@master
with:
cmd: yq '[.secretsmanagement-operator.version, .secretsmanagement-operator.prereleaseSuffix] | filter(.!=null and .!="") | join("-")' charts/canvas-oda/values.yaml
- name: Check Version
id: check-tag
run: |
echo
if [[ ${{ steps.get_smanop_version.outputs.result }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Version ${{ steps.get_smanop_version.outputs.result }} matches release format <n>.<n>.<n>"
else
echo "::error::Version ${{ steps.get_smanop_version.outputs.result }} does not match release format <n>.<n>.<n>" && exit 1
fi
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Check for already existing image tag
id: check_docker_image
uses: KerberosMorphy/[email protected]
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
image: ${{ steps.get_smanop_image.outputs.result }}:${{ steps.get_smanop_version.outputs.result }}
- name: error if tag already exists
if: steps.check_docker_image.outputs.image_exist==1
run: |
echo "::error::image tag ${{ steps.get_smanop_version.outputs.result }} already exists in repo ${{ steps.get_smanop_image.outputs.result }}, exiting!" && exit 2
- 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/docker
build-args: |
SOURCE_DATE_EPOCH=${{ env.SOURCE_DATE_EPOCH }}
GIT_COMMIT_SHA=${{ env.GIT_COMMIT_SHA }}
CICD_BUILD_TIME=${{ env.CICD_BUILD_TIME }}
# arm64 has problems building cffi python wheel
#platforms: linux/amd64,linux/arm64
platforms: linux/amd64
push: true
tags: |
${{ steps.get_smanop_image.outputs.result }}:latest
${{ steps.get_smanop_image.outputs.result }}:${{ steps.get_smanop_version.outputs.result }}
env:
SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}