-
Notifications
You must be signed in to change notification settings - Fork 4
78 lines (70 loc) · 2.59 KB
/
dispatch_make_helm_chart.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
name: "[Dispatch] Make Helm Chart"
on:
workflow_dispatch:
repository_dispatch:
types: [make_helm_chart]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
helm_cloudforet:
if: github.repository_owner == 'cloudforet-io'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Helm
uses: azure/setup-helm@v1
with:
version: '3.4.0'
- name: Run Helm packaging
run: |
export cache_dir=/tmp/helm
mkdir -p "$cache_dir"
echo "Installing chart-releaser..."
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v1.2.0/chart-releaser_1.2.0_linux_amd64.tar.gz"
tar -xzf cr.tar.gz -C "$cache_dir"
rm -f cr.tar.gz
echo 'Adding cr directory to PATH...'
export PATH="$cache_dir:$PATH"
rm -rf .deploy
echo 'Print Version ...'
export SERVICE=$(echo ${{ github.repository }} | cut -d '/' -f2)
echo 'Update helm version in chart.yaml and values.yaml'
echo "SERVICE=${SERVICE}" >> $GITHUB_ENV
helm package deploy/helm --destination .deploy
cr upload -o cloudforet-io -r charts -p .deploy --token ${{ secrets.PAT_TOKEN }}
cr index -i ./index.yaml -p .deploy/ -o cloudforet-io -r charts -c https://cloudforet-io.github.io/charts --token ${{ secrets.PAT_TOKEN }}
cp index.yaml /tmp/index.yaml
- name: Check out chart repo
uses: actions/checkout@master
with:
repository: cloudforet-io/charts
ref: gh-pages
token: ${{ secrets.PAT_TOKEN }}
- name: Update Helm repository index.yaml
run: |
git config --global user.email [email protected]
git config --global user.name cloudforet-admin
cp /tmp/index.yaml ./
git add index.yaml
git pull
git commit -m "Add ${SERVICE} chart"
git push origin gh-pages
- name: Notice when job fails
if: failure()
uses: 8398a7/[email protected]
with:
status: ${{job.status}}
fields: repo,workflow,job
author_name: Github Action Slack
notify_to_slack:
if: github.repository_owner == 'cloudforet-io'
needs: [helm_cloudforet]
runs-on: ubuntu-latest
steps:
- name: Slack
if: always()
uses: 8398a7/[email protected]
with:
status: ${{job.status}}
fields: repo,message,commit,author,action,eventName,ref,workflow,job,took
author_name: Github Action Slack