-
Notifications
You must be signed in to change notification settings - Fork 3
98 lines (86 loc) · 3.2 KB
/
upload-chart.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
name: CHART-UPLOAD
on:
push:
branches:
- 'main'
paths:
- 'upload-charts/*.tgz'
workflow_dispatch:
inputs:
CHART_PACKAGE_NAME:
description: "The package name of helm chart, push to apecloud-cd upload-charts dir first (e.g. pyroscope-0.2.92.tgz)"
required: false
default: ''
CHART_PACKAGE_URL:
description: "The package url of helm chart"
required: false
default: ''
PROJECT_ID:
description: "The jihulab project id to upload (e.g. kubeblocks/addons/applications)"
type: string
required: false
default: ''
run-name: upload ${{ inputs.CHART_PACKAGE_NAME }} ${{ inputs.CHART_PACKAGE_URL }}
env:
CR_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
JIHULAB_ACCESS_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}
JIHULAB_ACCESS_USER: ${{ secrets.GITLAB_ACCESS_USER }}
CR_VERSION: 1.4.1
jobs:
upload-chart:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: install cr
run: |
bash ${{ github.workspace }}/.github/utils/helm_package.sh --install-cr true
- name: copy helm chart
run: |
if [[ -n "${{ inputs.CHART_PACKAGE_URL }}" ]]; then
PACKAGE_NAME=$(echo "${{ inputs.CHART_PACKAGE_URL }}" | rev | cut -d'/' -f1 | rev)
curl -L -O ${{ inputs.CHART_PACKAGE_URL }}
mv $PACKAGE_NAME .cr-release-packages
elif [[ -n "${{ inputs.CHART_PACKAGE_NAME }}" ]]; then
cp upload-charts/${{ inputs.CHART_PACKAGE_NAME }} .cr-release-packages
else
bash ${{ github.workspace }}/.github/utils/utils.sh --type 20
fi
- name: Checkout helm-charts Code
uses: actions/checkout@v4
with:
repository: apecloud/helm-charts
path: helm-charts
token: ${{ env.CR_TOKEN }}
- name: Checkout kubeblocks-addons Code
uses: actions/checkout@v4
with:
repository: apecloud/kubeblocks-addons
path: kubeblocks-addons
token: ${{ env.CR_TOKEN }}
- name: Upload Helm Charts to Jihulab
run: |
ls .cr-release-packages
cd .cr-release-packages
bash ${{ github.workspace }}/.github/utils/release_gitlab.sh \
--type 3 \
--asset-path ./ \
--charts-dir "${{ github.workspace }}/kubeblocks-addons/addons|${{ github.workspace }}/helm-charts/charts|${{ github.workspace }}/deploy" \
--access-token "${{ env.JIHULAB_ACCESS_TOKEN }}" \
--access-user "${{ env.JIHULAB_ACCESS_USER }}" \
--project-id "${{ env.PROJECT_ID }}"
- name: Fetch helm-charts History And Configure Git
run: |
cd helm-charts
git fetch --prune --unshallow
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Upload and Index Helm Charts
shell: bash
run: |
cd helm-charts
args=(--owner "apecloud" --repo "helm-charts")
bash ${{ github.workspace }}/.github/utils/helm_release.sh "${args[@]}"