-
Notifications
You must be signed in to change notification settings - Fork 0
143 lines (121 loc) · 3.49 KB
/
s3-release-only-changed.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
name: Release changed charts to S3
on:
workflow_dispatch:
pull_request:
branches:
- main
paths:
- charts/**
types:
- opened
- synchronize
- closed
permissions:
id-token: write
contents: read
jobs:
generate-matrix:
outputs:
list: ${{ steps.list.outputs.list }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v40
with:
dir_names: true
dir_names_exclude_current_dir: true
dir_names_max_depth: 2
- name: Show changes
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
echo ${{ steps.changed-files.outputs.all_changed_files }} | tr " " "\n" | grep charts | xargs -n 1 basename | tr "\n" " " | jq -R -s -c 'split(" ")[:-1]' > res.json
echo "list<<EOF" >> $GITHUB_OUTPUT
cat res.json >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
template:
runs-on: ubuntu-latest
needs:
- generate-matrix
strategy:
matrix:
chart: ${{ fromJson(needs.generate-matrix.outputs.list) }}
defaults:
run:
working-directory: charts/${{ matrix.chart }}
steps:
- uses: actions/checkout@v3
- name: Update dependencies
run: helm dependency update
- name: Helm template
run: helm template .
# package:
# runs-on: ubuntu-latest
# needs:
# - generate-matrix
# strategy:
# matrix:
# chart: ${{ fromJson(needs.generate-matrix.outputs.list) }}
# defaults:
# run:
# working-directory: charts/${{ matrix.chart }}
# steps:
# - uses: actions/checkout@v3
# - uses: azure/setup-helm@v3
# with:
# version: v3.12.3
# - name: Update dependencies
# run: helm dependency update
# - name: Helm package
# run: helm package .
# - name: Get package name
# id: file
# run: echo name=$(ls | grep .tgz) >> $GITHUB_OUTPUT
# - name: Upload package
# uses: actions/upload-artifact@v3
# with:
# name: ${{ matrix.chart }}
# path: charts/${{ matrix.chart }}/${{ steps.file.outputs.name }}
# retention-days: 1
# release:
# env:
# HELM_S3_MODE: 3
# runs-on: ubuntu-latest
# needs:
# - generate-matrix
# - package
# - template
# strategy:
# matrix:
# chart: ${{ fromJson(needs.generate-matrix.outputs.list) }}
# steps:
# - name: Configure AWS credentials
# uses: aws-actions/configure-aws-credentials@v2
# with:
# role-to-assume: arn:aws:iam::506534868111:role/oidc/helm-s3
# role-session-name: helm-s3-${{ github.run_id }}
# aws-region: eu-central-1
# - uses: azure/setup-helm@v3
# with:
# version: v3.12.3
# - name: Install Helm S3 Plugin
# run: helm plugin install https://github.com/hypnoglow/helm-s3.git --version 0.14.0
# - name: Add Helm repo
# run: helm repo add mys3 s3://windkube-charts/charts
# - name: Download package
# uses: actions/download-artifact@v3
# with:
# name: ${{ matrix.chart }}
# - name: Get package name
# id: file
# run: |
# pwd
# ls
# echo name=$(ls | grep .tgz) >> $GITHUB_OUTPUT
# - name: Push chart
# run: helm s3 push ./${{ steps.file.outputs.name }} mys3 --ignore-if-exists