-
Notifications
You must be signed in to change notification settings - Fork 13
72 lines (62 loc) · 2.56 KB
/
chart-release.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
name: ChartRelease
on:
push:
tags:
- "chart/[a-z0-9]+-*" # match tags following the 'chart/$chartname-x.y.z'
jobs:
gh-pages:
runs-on: ubuntu-latest
steps:
# We can't use 'go install' due to some go.mod conflicts.
- name: Download cr
uses: giantswarm/install-binary-action@v1.1.0
with:
binary: cr
version: "1.4.1"
download_url: https://github.com/helm/chart-releaser/releases/download/v${version}/chart-releaser_${version}_linux_amd64.tar.gz
tarball_binary_path: "${binary}"
smoke_test: "${binary} version"
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Get chart name
run: echo "CHART_NAME=$(echo ${GITHUB_REF##*/} | grep --perl-regexp --only-matching '^([a-zA-Z0-9-]+)(?![0-9.]+)')" >> $GITHUB_ENV
- name: Get chart versions
run: |
echo "CHART_VERSION=$(yq e '.version' charts/${CHART_NAME}/Chart.yaml)" >> $GITHUB_ENV
echo "PREVIOUS_CHART_VERSION=$(git tag --sort=taggerdate --list "chart/${CHART_NAME}-*" | tail -n 2 | head -n 1 | rev | cut -d - -f 1 | rev)" >> $GITHUB_ENV
- name: Prepare changelog config
run: .github/changelog-charts.sh ${CHART_NAME}
- name: Generate additional artifacts
run: make chart-generate
- name: Build changelog from PRs with labels
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3
with:
configuration: ".github/configuration.json"
ignorePreReleases: true
outputFile: charts/${{ env.CHART_NAME}}/CHANGELOG.md
fromTag: chart/${{ env.CHART_NAME }}-${{ env.PREVIOUS_CHART_VERSION }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Package Helm chart
run: |
make chart-release
env:
CR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CR_OWNER: ${{ github.repository_owner }}
CR_GIT_REPO: ${{ github.event.repository.name }}
# there doesn't seem to be any maintained GitHub actions that allow uploading assets after release has been made.
- name: Update release
run: |
gh release upload chart/${CHART_NAME}-${CHART_VERSION} .github/crds.yaml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}