-
Notifications
You must be signed in to change notification settings - Fork 22
62 lines (58 loc) · 1.96 KB
/
chart-upload.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
name: ChartUpload
permissions:
contents: read
on:
release:
types: [published]
env:
CHART_NAME: managed-serviceaccount
jobs:
env:
name: prepare release env
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: get release version
id: get_release_version
run: |
RELEASE_VERSION=${GITHUB_REF#refs/tags/}
echo "::set-output name=RELEASE_VERSION::${RELEASE_VERSION}"
echo "::set-output name=MAJOR_RELEASE_VERSION::${RELEASE_VERSION%.*}"
echo "::set-output name=TRIMMED_RELEASE_VERSION::${RELEASE_VERSION#v}"
outputs:
RELEASE_VERSION: ${{ steps.get_release_version.outputs.RELEASE_VERSION }}
MAJOR_RELEASE_VERSION: ${{ steps.get_release_version.outputs.MAJOR_RELEASE_VERSION }}
TRIMMED_RELEASE_VERSION: ${{ steps.get_release_version.outputs.TRIMMED_RELEASE_VERSION }}
upload:
name: upload
runs-on: ubuntu-latest
needs: [ env ]
permissions:
contents: write
steps:
- name: submit charts to OCM chart repo
if: github.event_name != 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{ secrets.OCM_BOT_PAT }}
script: |
try {
const result = await github.rest.actions.createWorkflowDispatch({
owner: 'open-cluster-management-io',
repo: 'helm-charts',
workflow_id: 'download-chart.yml',
ref: 'main',
inputs: {
repo: "${{ github.repository }}",
version: "${{ needs.env.outputs.TRIMMED_RELEASE_VERSION }}",
"chart-name": "${{ env.CHART_NAME }}",
},
})
console.log(result);
} catch(error) {
console.error(error);
core.setFailed(error);
}