-
Notifications
You must be signed in to change notification settings - Fork 5
84 lines (77 loc) · 2.67 KB
/
call-release-chart.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: Call Release Charts
env:
HELM_VERSION: v3.10.1
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
workflow_dispatch:
inputs:
ref:
description: 'tag, sha, branch'
required: true
default: v1.0.0
push:
description: 'push chart'
required: false
default: false
permissions: write-all
jobs:
chart-release:
name: Create Chart Release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Get Original Ref
id: get_original_ref
run: |
if ${{ github.event_name == 'workflow_dispatch' }} ; then
echo "call by workflow_dispatch"
echo "ref=${{ inputs.ref }}" >> $GITHUB_OUTPUT
echo "push=${{ inputs.push }}" >> $GITHUB_OUTPUT
elif ${{ github.event_name == 'push' }} ; then
echo "call by push"
ver=${{ github.ref }}
echo "ref=${ver}" >> $GITHUB_OUTPUT
echo "push=true" >> $GITHUB_OUTPUT
else
echo "unexpected event: ${{ github.event_name }}"
exit 1
fi
- name: Checkout
uses: actions/checkout@v2
with:
# Fetch entire history. Required for chart-releaser; see https://github.com/helm/chart-releaser-action/issues/13#issuecomment-602063896
fetch-depth: 0
ref: ${{ needs.get_original_ref.outputs.ref }}
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Chart releaser
run: |
# Download chart releaser
curl -sSLo cr.tar.gz "https://github.com/helm/chart-releaser/releases/download/v1.4.1/chart-releaser_1.4.1_linux_amd64.tar.gz"
tar -xzf cr.tar.gz
rm -f cr.tar.gz
repo=$(basename "$GITHUB_REPOSITORY")
owner=$(dirname "$GITHUB_REPOSITORY")
tag="${GITHUB_REF_NAME:1}"
echo "Creating release..."
# package chart
./cr package charts/cilium-chaining
# upload chart to github releases
./cr upload \
--owner "$owner" \
--git-repo "$repo" \
--skip-existing \
--release-name-template "{{ .Name }}-chart-{{ .Version }}" \
--token "${{ secrets.GITHUB_TOKEN }}"
# Update index and push to github pages
./cr index \
--owner "$owner" \
--git-repo "$repo" \
--index-path index.yaml \
--release-name-template "{{ .Name }}-chart-{{ .Version }}" \
--push ${{ steps.get_original_ref.outputs.push }}