-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (48 loc) · 1.78 KB
/
helm-release.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
name: Release Charts
on:
release:
types: [published]
env:
CHART_FILE: "charts/mongodb-profiler-exporter/Chart.yaml"
RELEASE_TAG: "${{ github.event.release.tag_name }}"
jobs:
release:
# depending on default permission settings for your org (contents being read-only or read-write for workloads), you will have to add permissions
# see: https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Check Tag
id: check-tag
run: |
if [[ "${{ github.event.release.tag_name }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "match=true" >> $GITHUB_ENV
else
echo "match=false" >> $GITHUB_ENV
fi
- name: Update version in Chart.yaml
if: env.match == 'true'
run: |
sed -i.bak "s/^version: .*/version: ${RELEASE_TAG}/" "$CHART_FILE"
sed -i.bak "s/^appVersion: .*/appVersion: ${RELEASE_TAG}/" "$CHART_FILE"
- name: Commit and push changes
if: env.match == 'true'
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
git add "${CHART_FILE}"
git commit -m "Update version to ${RELEASE_TAG}"
git push origin HEAD:main
- name: Install Helm
uses: azure/setup-helm@v4
if: env.match == 'true'
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Run chart-releaser
uses: helm/[email protected]
if: env.match == 'true'
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"