-
Notifications
You must be signed in to change notification settings - Fork 30
77 lines (65 loc) · 2.35 KB
/
release.yaml
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
name: release
on:
workflow_dispatch:
push:
branches:
- 'master'
jobs:
build:
name: Release
environment: ci-cd
runs-on: ubuntu-20.04
env:
# https://github.com/github/hub/releases
HUB_VERSION: 2.14.2
steps:
- uses: actions/checkout@v4
name: Check out code
- name: Install asdf tools
uses: asdf-vm/actions/install@v2
- name: install hub
run: |
curl -sSLO https://github.com/github/hub/releases/download/v${HUB_VERSION}/hub-linux-amd64-${HUB_VERSION}.tgz
tar -xzf hub-linux-amd64-${HUB_VERSION}.tgz
chmod +x hub-linux-amd64-${HUB_VERSION}/bin/hub
sudo mv hub-linux-amd64-${HUB_VERSION}/bin/hub /usr/local/bin/
- name: Set up Docker variables
id: set_variables
run: |
echo "SOPS_SEC_OPERATOR_VERSION=$(make image_tag)" >> $GITHUB_ENV
echo "IMAGE_FULL_NAME=$(make image_full_name)" >> $GITHUB_ENV
echo "IMAGE_LATEST_NAME=$(make image_latest_name)" >> $GITHUB_ENV
echo "IMAGE_CACHE_NAME=$(make image_cache_name)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASS }}
- name: Tag and release
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
run: |
set +e
git tag "${SOPS_SEC_OPERATOR_VERSION}"
tagResult=$?
if [[ $tagResult -ne 0 ]]; then
echo "Release '${SOPS_SEC_OPERATOR_VERSION}' exists - skipping"
exit 1
else
set -e
git-chglog "${SOPS_SEC_OPERATOR_VERSION}" > chglog.tmp
hub release create -F chglog.tmp "${SOPS_SEC_OPERATOR_VERSION}"
fi
- name: Docker build
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ env.IMAGE_LATEST_NAME }},${{ env.IMAGE_FULL_NAME }}
platforms: linux/amd64,linux/arm64
cache-from: type=registry,ref=${{ env.IMAGE_CACHE_NAME }}
cache-to: type=registry,ref=${{ env.IMAGE_CACHE_NAME }},mode=max