-
Notifications
You must be signed in to change notification settings - Fork 87
executable file
·54 lines (46 loc) · 1.45 KB
/
tag-charts.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
name: "Charts: Create git tag"
on:
workflow_call:
inputs:
charts:
description: >
Json encoded list of Helm charts to release.
Defaults to releasing everything.
default: "[]"
required: false
type: string
secrets:
APP_ID:
required: true
APP_PRIVATE_KEY:
required: true
env:
CHARTS_SRC_DIR: "charts"
jobs:
tag-charts:
name: Tag charts
runs-on: ubuntu-22.04
steps:
- name: "Generate Short Lived OAuth App Token (ghs_*)"
uses: actions/[email protected]
id: app-token
with:
app-id: "${{ secrets.APP_ID }}"
private-key: "${{ secrets.APP_SECRET }}"
- name: Checkout chart sources
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
with:
token: ${{ steps.app-token.outputs.token }}
fetch-depth: 0
- name: Create git tag for charts
shell: bash
run: |
CHARTS=( $(yq --null-input e '${{ inputs.charts }}[]' ) )
for CHART in "${CHARTS[@]}" ; do
mapfile -t CHART_PATH_PARTS < <(echo "$CHART" | tr '/' '\n')
CHART_TYPE=${CHART_PATH_PARTS[0]}
CHART_NAME=${CHART_PATH_PARTS[1]}
CHART_VERSION=$(yq e '.version' ${{ env.CHARTS_SRC_DIR }}/${CHART}/Chart.yaml)
git tag --force "${CHART_NAME}-${CHART_VERSION}"
done
git push --tags --force