This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
65 lines (52 loc) · 1.96 KB
/
render_task.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
name: Render Helm Chart and Change kind from Clustertask to Task
on:
workflow_call:
inputs:
NEXT_VERSION:
required: true
type: string
SUBPATH:
required: true
type: string
secrets:
STAKATER_GITHUB_TOKEN:
description: "Token for pushing code"
required: true
concurrency:
group: helm-chart-rendering
jobs:
render_and_replace:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
with:
version: v3.7.0
- name: Render Helm Chart
run: |
helm template test-chart ${{ inputs.SUBPATH }}/helm > ${{ inputs.SUBPATH }}-${{ inputs.NEXT_VERSION }}.yaml
- name: Create Directory
run: mkdir -p ${{ inputs.SUBPATH }}/rendered
- name: Move Rendered Chart
run: mv ${{ inputs.SUBPATH }}-${{ inputs.NEXT_VERSION }}.yaml ${{ inputs.SUBPATH }}/rendered
- name: Replace Word in Rendered File
run: |
sed -i 's/ClusterTask/Task/g' ${{ inputs.SUBPATH }}/rendered/${{ inputs.SUBPATH }}-${{ inputs.NEXT_VERSION }}.yaml
sed -i -E 's/${{ inputs.SUBPATH }}-[0-9]+\.[0-9]+\.[0-9]+/${{ inputs.SUBPATH }}-${{ inputs.NEXT_VERSION }}/g' ${{ inputs.SUBPATH }}/rendered/${{ inputs.SUBPATH }}-${{ inputs.NEXT_VERSION }}.yaml
- name: Commit Changes
run: |
git pull --quiet origin main || true
git config --global user.email "[email protected]"
git config --global user.name "stakater-user"
git add ${{ inputs.SUBPATH }}/rendered
git commit -m "[skip ci] Add rendered and modified Helm chart"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.STAKATER_GITHUB_TOKEN }}
branch: ${{ github.ref }}