-
Notifications
You must be signed in to change notification settings - Fork 0
67 lines (58 loc) · 1.89 KB
/
publish-charts.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
name: Publish Helm charts
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
check-app:
name: Check if commit was pushed by GitHub App
runs-on: ubuntu-latest
outputs:
pushed-by-app: ${{ steps.check-app.outputs.pushed-by-app }}
steps:
- name: Check if commit was pushed by GitHub App
id: check-app
run: |
if [[ '${{ github.actor }}' == '${{ vars.GH_APP_USERNAME }}' ]]; then
echo 'Commit was pushed by GitHub App.'
echo "pushed-by-app=true" >> "$GITHUB_OUTPUT"
fi
publish-helm-charts:
name: Publish Helm charts
runs-on: elvia-runner
needs: [check-app]
if: ${{ needs.check-app.outputs.pushed-by-app != 'true' }}
steps:
- name: Get GitHub App token for repository
uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}}
- name: Package charts
run: |
helm package elvia-deployment
helm package elvia-statefulset
helm package iss-deployment
- name: Index Helm repository
run: helm repo index .
- name: Push packaged charts to GitHub repository
# Only on push to master
if: github.ref == 'refs/heads/master'
run: |
if [[ -z "$(git status --porcelain)" ]]; then
echo 'No changes to commit.'
exit 0
fi
git config user.email '${{ vars.GH_APP_USER_EMAIL }}'
git config user.name '${{ vars.GH_APP_USERNAME }}'
git add .
git commit -m 'Publish Helm charts'
git push