-
Notifications
You must be signed in to change notification settings - Fork 27
106 lines (104 loc) · 4.19 KB
/
production.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Push to production Helm chart repo
on:
push:
branches: [ production ]
jobs:
build:
environment: production
runs-on: ubuntu-latest
outputs:
addons-matrix: ${{ steps.addons-matrix.outputs.matrix }}
applications-matrix: ${{ steps.applications-matrix.outputs.matrix }}
ref: ${{ steps.auto-commit-action.outputs.commit_hash }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: azure/setup-helm@v3
with:
version: 'v3.3.4'
- name: Install yq
run: |
wget https://github.com/mikefarah/yq/releases/download/v4.35.2/yq_linux_amd64 -O ./yq
chmod +x ./yq
sudo mv ./yq /usr/local/bin/yq
- name: Build modified application charts
run: |
./scripts/build.sh applications ${{ github.sha }} ${{ github.event.before }}
env:
CHARTMUSEUM_USERNAME: ${{ secrets.CHARTMUSEUM_USERNAME }}
CHARTMUSEUM_PASSWORD: ${{ secrets.CHARTMUSEUM_PASSWORD }}
CHARTMUSEUM_URL: ${{ secrets.CHARTMUSEUM_URL }}
- name: Build modified addon charts
run: |
./scripts/build.sh addons ${{ github.sha }} ${{ github.event.before }}
env:
CHARTMUSEUM_USERNAME: ${{ secrets.CHARTMUSEUM_ADDON_USERNAME }}
CHARTMUSEUM_PASSWORD: ${{ secrets.CHARTMUSEUM_ADDON_PASSWORD }}
CHARTMUSEUM_URL: ${{ secrets.CHARTMUSEUM_ADDON_URL }}
- name: Set matrix for applications publishing
id: applications-matrix
run: |
matrix="$(git diff --name-only ${{ github.sha }} ${{ github.event.before }} | cut -f1,2,3 -d'/' | xargs -n 1 dirname | uniq | grep "applications/" | jq --compact-output --monochrome-output --raw-input --slurp 'split("\n") | map(select(. != ""))')"
if [[ "$matrix" == "[]" ]]; then
matrix='["null-chart"]'
fi
variable="{\"index\":$matrix}"
echo "matrix=$variable" >> $GITHUB_OUTPUT
- name: Set matrix for addons publishing
id: addons-matrix
run: |
matrix="$(git diff --name-only ${{ github.sha }} ${{ github.event.before }} | cut -f1,2,3 -d'/' | xargs -n 1 dirname | uniq | grep "addons/" | jq --compact-output --monochrome-output --raw-input --slurp 'split("\n") | map(select(. != ""))')"
if [[ "$matrix" == "[]" ]]; then
matrix='["null-chart"]'
fi
variable="{\"index\": $matrix}"
echo "matrix=$variable" >> $GITHUB_OUTPUT
- uses: stefanzweifel/git-auto-commit-action@v4
id: auto-commit-action
with:
commit_message: Update Chart.yaml versions
commit_options: '--allow-empty'
file_pattern: "*/*/Chart.yaml"
commit_user_name: portersupport
commit_user_email: [email protected]
publish-addons:
environment: production
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build.outputs.addons-matrix)}}
steps:
- name: Checkout porter-charts
uses: actions/checkout@v4
with:
ref: ${{ needs.build.outputs.ref }}
- name: Update remote chart
uses: ./.github/actions/publish-chart
if: ${{ matrix.index != 'null-chart' }}
with:
chart_path: ${{ matrix.index }}
chartmuseum_username: ${{ secrets.CHARTMUSEUM_ADDON_USERNAME }}
chartmuseum_password: ${{ secrets.CHARTMUSEUM_ADDON_PASSWORD }}
chartmuseum_url: ${{ secrets.CHARTMUSEUM_ADDON_URL }}
publish-applications:
environment: production
runs-on: ubuntu-latest
needs: build
strategy:
fail-fast: false
matrix: ${{fromJson(needs.build.outputs.applications-matrix)}}
steps:
- name: Checkout porter-charts
uses: actions/checkout@v4
with:
ref: ${{ needs.build.outputs.ref }}
- name: Update remote chart
uses: ./.github/actions/publish-chart
if: ${{ matrix.index != 'null-chart' }}
with:
chart_path: ${{ matrix.index }}
chartmuseum_username: ${{ secrets.CHARTMUSEUM_USERNAME }}
chartmuseum_password: ${{ secrets.CHARTMUSEUM_PASSWORD }}
chartmuseum_url: ${{ secrets.CHARTMUSEUM_URL }}