-
Notifications
You must be signed in to change notification settings - Fork 7
83 lines (78 loc) · 2.9 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
78
79
80
81
82
83
name: Release hstream operator
on:
push:
tags:
- "*"
branches-ignore:
- "main"
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: azure/setup-helm@v3
- name: Check chart version
if: ${{ github.ref_type == 'tag' }}
run: |
version=$(helm show chart deploy/charts/hstream-operator | grep version | awk '{print $2}')
if [[ "$version" != "$GITHUB_REF_NAME" ]]; then
echo "You need to update the version in Chart.yaml."
exit 1
fi
- name: Check chart appVersion
if: ${{ github.ref_type == 'tag' }}
run: |
appVersion=$(helm show chart deploy/charts/hstream-operator | grep appVersion | awk '{print $2}')
if [[ "$appVersion" != "$GITHUB_REF_NAME" ]]; then
echo "You need to update the appVersion in Chart.yaml."
exit 1
fi
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v2
- uses: docker/metadata-action@v4
id: meta
with:
images: ${{ github.repository_owner }}/hstream-operator-controller
tags: |
type=ref,event=tag
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Generate hstream-operator.yaml
id: yaml
run: |
make kustomize
pushd config/manager && kustomize edit set image controller="${{ github.repository_owner }}/hstream-operator-controller:${{ github.ref_name }}" && popd
kustomize build config/default > hstream-operator.yaml
echo "yaml=hstream-operator.yaml" >> $GITHUB_OUTPUT
- name: Draft or not
id: draft
run: |
if grep -q "^\d+\.\d+\.\d+$" "${{ github.ref_name }}"; then
echo "draft=false" >> $GITHUB_OUTPUT
else
echo "draft=true" >> $GITHUB_OUTPUT
fi
- name: Create GitHub release
uses: softprops/action-gh-release@v1
with:
token: ${{ github.token }}
name: HStream Operator ${{ github.ref_name }}
generate_release_notes: ${{ steps.draft.outputs.draft == 'false' }}
draft: ${{ steps.draft.outputs.draft }}
body: |
HStream Operator ${{ github.ref_name }} has been released.
See [CHANGELOG](https://github.com/hstreamdb/hstream-operator/blob/main/CHANGELOG.md) for more details.
files: |
${{ steps.yaml.outputs.yaml }}