-
Notifications
You must be signed in to change notification settings - Fork 8
98 lines (85 loc) · 2.68 KB
/
publish.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
name: Publish Docker image and Helm chart
on:
push
jobs:
run_tests:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v3
with:
go-version: '1.19'
- name: Check out the repo
uses: actions/checkout@v2
- name: Test
run: go test ./...
create_docker_container:
name: Push Docker image to Github Registry
if: ${{ github.ref_name == 'main'}}
needs: [run_tests]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
# Get the version tag from Chart.yaml's appVersion tag
- name: Get appVersion
id: get_appversion
uses: CumulusDS/[email protected]
with:
file: charts/cronitor-kubernetes/Chart.yaml
appVersion: appVersion
- name: Docker meta
id: meta
uses: docker/metadata-action@v3
with:
images: |
ghcr.io/cronitorio/cronitor-kubernetes
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}},value=${{ steps.get_appversion.outputs.appVersion }}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Github Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push to Github Registry
id: docker_build
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
publish_helm_chart:
name: Create and publish Helm chart to Github pages
needs: [create_docker_container]
runs-on: ubuntu-latest
if: ${{ github.ref_name == 'main' }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Configure git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0
- name: Run chart-releaser
uses: helm/[email protected]
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"