-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (89 loc) · 3.09 KB
/
manual-generate.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
# if your local host is not reachable to Opensource Chart, you could trigger this to build /charts/$PROJECT/$PROJECT
name: Call Generate Chart
env:
MERGE_BRANCH: main
PR_LABEL: pr/release/robot_update_chart
PR_REVIWER: lijie
on:
workflow_dispatch:
inputs:
project:
description: 'project name'
required: true
ref:
description: 'branch name, tag or sha'
required: true
default: main
permissions: write-all
jobs:
package:
runs-on: ubuntu-latest
steps:
# some event, the tag is not sha, so checkout it and get sha
- name: Checkout code
uses: actions/checkout@v3
with:
persist-credentials: false
ref: ${{ github.event.inputs.ref }}
- name: Result Ref
id: result
run: |
ref=$( git show -s --format='format:%H')
echo ::set-output name=ref::${ref}
- name: Set up Helm
uses: azure/[email protected]
- name: Install helm-schema-gen
run: |
helm plugin install https://github.com/karuppiah7890/helm-schema-gen.git
- name: generate chart
run: |
[ ! -d "charts/${{ github.event.inputs.project }}" ] && echo "error, failed to find project ${{ github.event.inputs.project }} under /charts " && exit 1
make -e PROJECT=${{ github.event.inputs.project }}
- name: package chart
id: package_chart
run: |
ROOT_DIR=`pwd`
mkdir _upload
cd _upload
helm package ${ROOT_DIR}/charts/${{ github.event.inputs.project }}/${{ github.event.inputs.project }}
FILENAME=`ls *.tgz`
echo ::set-output name=filepath::${ROOT_DIR}/_upload/${FILENAME}
- name: Upload chart artifact
uses: actions/[email protected]
with:
name: charts
path: ${{ steps.package_chart.outputs.filepath }}
retention-days: 1
# update /index.yaml in the target branch
create_pr:
runs-on: ubuntu-latest
needs: [ package ]
steps:
- name: Checkout Code
uses: actions/checkout@v3
with:
ref: ${{ env.MERGE_BRANCH }}
persist-credentials: "true"
- name: Download Artifact
uses: actions/download-artifact@v3
with:
name: charts
path: ./charts/${{ github.event.inputs.project }}
- name: prepare
run: |
cd charts/${{ github.event.inputs.project }}
rm -rf ${{ github.event.inputs.project }}
tar xzvf *.tgz
rm -f *.tgz
- name: Create Pull Request
uses: peter-evans/[email protected]
with:
title: "robot Update ${{ github.event.inputs.project }} chart to branch ${{ env.MERGE_BRANCH }} "
commit-message: "robot Update ${{ github.event.inputs.project }} chart to branch ${{ env.MERGE_BRANCH }} "
branch-suffix: timestamp
branch: robot/update_chart
delete-branch: true
base: ${{ env.MERGE_BRANCH }}
signoff: true
token: ${{ secrets.GITHUB_TOKEN }}
labels: ${{ env.PR_LABEL }}