-
Notifications
You must be signed in to change notification settings - Fork 2
79 lines (69 loc) · 2.94 KB
/
helm-release-k8s-health-agent.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
name: Release K8s Health Agent Charts
on:
workflow_dispatch:
push:
branches: ['main']
paths: ['k8s-health-agent/Chart.yaml']
env:
GITHUB_TOKEN: "${{ secrets.CR_TOKEN }}"
CR_TOKEN: "${{ secrets.CR_TOKEN }}"
jobs:
release:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "syntassodev"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@v3
- name: Run chart-releaser
uses: helm/[email protected]
with:
charts_dir: .
pages_branch: gh-pages
skip_existing: true
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: eu-west-2
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Upload Charts to Releases Bucket
run: |
VERSION=$(grep '^version:' k8s-health-agent/Chart.yaml | awk '{print $2}' | head -n 1)
bucket_path="s3://syntasso-enterprise-releases/k8s-health-agent-helm-chart/${VERSION}/"
if [ -f .cr-release-packages/k8s-health-agent-${VERSION}.tgz ]; then
echo "Uploading k8s-health-agent-${VERSION}.tgz to ${bucket_path}"
aws s3 cp .cr-release-packages/k8s-health-agent-${VERSION}.tgz ${bucket_path}
else
echo "No new package created, skipping upload"
fi
- name: Update SKE Destination Helm
run: |
VERSION=$(grep '^version:' k8s-health-agent/Chart.yaml | awk '{print $2}' | head -n 1)
if [ -f .cr-release-packages/k8s-health-agent-${VERSION}.tgz ]; then
echo "Updating Chart.yaml in ske-destination"
export current_k8s_health_agent_version="$(yq -r '.version' k8s-health-agent/Chart.yaml)"
current_ske_destination_chart_version="$(yq -r '.version' ske-destination/Chart.yaml)"
export new_ske_destination_chart_version="$(echo $current_ske_destination_chart_version | awk -F. '{$2 = $2 + 1;} 1' | sed 's/ /./g')"
yq -i '.version = env(new_ske_destination_chart_version)' ske-destination/Chart.yaml
yq -i '.dependencies[1].version = env(current_k8s_health_agent_version)' ske-destination/Chart.yaml
else
echo "No new package created, skipping update to Chart.yaml in ske-destination"
fi
- name: Commit and push changes
run: |
if [ -z "$(git status --porcelain ske-destination/Chart.yaml)" ]; then
echo "no changes to commit; exiting"
exit 0
fi
git add ske-destination/Chart.yaml
git commit -m "feat: update K8s Health Agent in SKE Destination chart"
git push