-
Notifications
You must be signed in to change notification settings - Fork 7
79 lines (64 loc) · 2.14 KB
/
build-and-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
name: Build, Test and Publish
on:
push:
branches:
- master
jobs:
build-test-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.19
cache-dependency-path: go.sum
- name: Install dependencies
run: make install
- name: Build
run: make build
#- name: Test
# run: make test
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push Docker image
run: |
make docker-build
docker push cube8021/kubebackup:latest
- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.7.1
- name: Package Helm chart
run: |
export CHART_VERSION="0.1.${{ github.run_number }}"
export APP_VERSION="0.1.${{ github.run_number }}"
echo "CHART_VERSION=${CHART_VERSION}"
echo "APP_VERSION=${APP_VERSION}"
envsubst < helm/kubebackup/Chart.yaml.template > helm/kubebackup/Chart.yaml
envsubst < helm/kubebackup/values.yaml.template > helm/kubebackup/values.yaml
helm package helm/kubebackup --destination helm/repo
- name: Checkout helm-chart repository
uses: actions/checkout@v2
with:
repository: SupportTools/helm-chart
path: helm-chart
token: ${{ secrets.BOT_TOKEN }}
- name: Configure Git
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Action"
- name: Update Helm repository
run: |
cp helm/repo/kubebackup-*.tgz helm-chart/
cd helm-chart
helm repo index . --url https://charts.support.tools/
git add .
git commit -m "Update Helm chart for KubeBackup"
git push