-
Notifications
You must be signed in to change notification settings - Fork 41
117 lines (99 loc) · 2.93 KB
/
ci.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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: CI
on:
# push:
# branches: [ main ]
pull_request:
branches: [main]
workflow_dispatch:
push:
branches: [main]
tags:
- v*
jobs:
build-operator:
runs-on: ubuntu-latest
env:
IMG: ghcr.io/dragonflydb/operator:${{ github.sha }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Docker Build
run: |
make docker-build
- uses: helm/[email protected]
with:
cluster_name: kind
config: ./hack/kind-config.yaml
- name: Run tests
timeout-minutes: 12
run: |
make docker-kind-load
make deploy
make test
- name: Cleanup
run: |
make undeploy
release-operator:
permissions:
contents: write
packages: write
runs-on: ubuntu-latest
needs: build-operator
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
env:
IMG: ghcr.io/dragonflydb/operator:${{ github.ref_name }}
VERSION: ${{ github.ref_name }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Build
run: |
make build
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Github container repository
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Install helm
uses: azure/setup-helm@v4
- name: Push Helm chart as OCI to Github
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
helm registry login -u ${{ github.actor }} --password-stdin ghcr.io
helm package charts/dragonfly-operator
helm push dragonfly-operator-${{ env.VERSION }}.tgz oci://ghcr.io/dragonflydb/dragonfly-operator/helm
- name: Build and Publish image into GHCR
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ghcr.io/dragonflydb/operator:${{ github.ref_name }}
platforms: |
linux/amd64
linux/arm64
env:
DOCKER_BUILDKIT: 1
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: publish github release
uses: softprops/action-gh-release@v1
with:
files: |
./bin/dragonfly-operator
LICENSE
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
body: |
Release ${{ github.ref_name }}
Docker image: ghcr.io/dragonflydb/operator:${{ github.ref_name }}
Helm chart: oci://ghcr.io/dragonflydb/dragonfly-operator/helm
draft: true