-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (57 loc) · 2.02 KB
/
chart-dependency-update.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
name: Update Chart Dependencies
on:
push:
branches-ignore:
- main
- artifacts
jobs:
update_chart_locks:
runs-on: ARM64
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.CZI_RELEASE_PLEASE_APP_ID }}
private_key: ${{ secrets.CZI_RELEASE_PLEASE_PK }}
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ steps.generate_token.outputs.token }}
- uses: dorny/paths-filter@v3
id: filter
with:
initial-fetch-depth: '1'
list-files: json
filters: |
changed:
- added|modified: '**'
- uses: actions/github-script@v7
id: changed_charts
with:
script: |
const fs = require('fs');
const path = require("path");
const changedFiles = ${{ steps.filter.outputs.changed_files }}
const changedDirs = changedFiles.map(f => path.dirname(f)).filter(dir => fs.existsSync(path.join(dir, 'Chart.yaml')));
const uniqueChangedDirs = [...new Set(changedDirs)];
console.log(`Found the following changed charts: ${JSON.stringify(uniqueChangedDirs, null, 2)}\n OG: ${JSON.stringify(changedFiles, null, 2)} `)
core.setOutput('changed_chart_dirs', uniqueChangedDirs)
core.setOutput('changed_chart_dirs_bash', uniqueChangedDirs.join(' '));
- uses: azure/setup-helm@v4
with:
version: '3.15.2'
- name: Update Chart.lock
run: |
for chart in ${{ steps.changed_charts.outputs.changed_chart_dirs_bash }}
do
echo "----------------------------------------"
echo "Updating ${chart}/Chart.lock"
helm dependency update ${chart}
git diff ${chart}/Chart.lock
done
- name: Commit changes
uses: EndBug/add-and-commit@v9
with:
add: -A
message: 'ci - update chart dependencies'