-
Notifications
You must be signed in to change notification settings - Fork 19
65 lines (53 loc) · 1.92 KB
/
Copy pathhelmchart-publish.yml
File metadata and controls
65 lines (53 loc) · 1.92 KB
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: Publish OCI charts
on:
workflow_dispatch:
inputs:
index_path:
description: 'OCI index-latest.yaml path, without registry hostname'
required: true
env:
REGISTRY: quay.io
jobs:
helmchart-publish:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 0
- name: Setup Oras
uses: oras-project/setup-oras@v1
- name: Download index-latest.yaml from workflow input
#uses: mikefarah/yq@master
run: |
oras pull ${REGISTRY}/${{ inputs.index_path }}
cat index-latest.yaml
- name: Get index-latest.yaml chart name
id: get_chart_name
uses: mikefarah/yq@master
with:
cmd: yq '.entries | to_entries[0] | (.key)' index-latest.yaml
- name: Get index-latest.yaml chart version
id: get_chart_version
uses: mikefarah/yq@master
with:
cmd: yq '.entries | to_entries[0] | (.value[0].version)' index-latest.yaml
- name: Remove potential duplicate prior to merge
uses: mikefarah/yq@master
with:
cmd: yq -i 'del(.entries.["${{ steps.get_chart_name.outputs.result }}"][] | select(.version == "${{ steps.get_chart_version.outputs.result }}"))' index.yaml
- name: Merge index-latest.yaml into index.yaml
uses: mikefarah/yq@master
with:
cmd: yq -i eval-all 'select(fi == 0) *++ select(fi == 1) | select(fi == 0)' index.yaml index-latest.yaml
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Publish chart ${{ steps.get_chart_name.outputs.result }} version ${{ steps.get_chart_version.outputs.result }}
branch: gh-pages
file_pattern: 'index.yaml'
skip_fetch: true
skip_checkout: true