Skip to content

Commit 59d164d

Browse files
mergify[bot]tthvo
andauthored
feat(ci): chart release workflow (#71) (#86)
* feat(ci): chart release workflow Signed-off-by: Thuan Vo <thvo@redhat.com> * ci(release-config): adjust release config category labels * feat(helm-release): use github auto-generated release notes * ci(helm-release): add missing github token * ci(release-notes): put release notes into chart packages Reference error: The release note file ".github/release-notes.md", is not present in the chart package * ci(release): manually compute previous tag * ci(release): reuse previous step output --------- Signed-off-by: Thuan Vo <thvo@redhat.com> (cherry picked from commit 04c9baa) Co-authored-by: Thuan Vo <thvo@redhat.com>
1 parent 1a4a296 commit 59d164d

File tree

6 files changed

+72
-85
lines changed

6 files changed

+72
-85
lines changed

.github/helm-release-config.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
release-name-template: "v{{ .Version }}"
2+
release-notes-file: release-notes.md

.github/release-drafter.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/release.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
changelog:
2+
categories:
3+
- title: '🚀 Features'
4+
labels:
5+
- 'feat'
6+
- title: '🔧 Fixes'
7+
labels:
8+
- 'fix'
9+
- title: '📄 Documentation'
10+
labels:
11+
- 'docs'
12+
- title: '⚙️ Maintenance'
13+
labels:
14+
- 'chore'
15+
- 'ci'
16+
- 'perf'
17+
- 'test'
18+
- 'build'
19+
- title: 'Others'
20+
labels:
21+
- "*"

.github/workflows/helm-release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release Helm Chart
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
helm-release:
8+
permissions:
9+
contents: write
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
with:
14+
fetch-depth: 0
15+
- name: Configure Git
16+
run: |
17+
git config user.name "$GITHUB_ACTOR"
18+
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
19+
- name: Get release version
20+
id: release-version
21+
run: |
22+
echo "tag=v$(yq .version charts/cryostat/Chart.yaml)" >> $GITHUB_OUTPUT
23+
- name: Get previous version
24+
id: previous-version
25+
run: |
26+
# Filter tags by regex, combine with the Chart version, sort by version number, and output the preceeding version.
27+
chart_version="${{ steps.release-version.outputs.tag }}"
28+
previous_version="$({ echo v${chart_version}; git tag -l | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$'; } | sort -V | grep -B1 "${chart_version}" | head -n1)"
29+
echo "tag=${previous_version}" >> $GITHUB_OUTPUT
30+
- name: Generate release notes
31+
env:
32+
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
33+
run: |
34+
gh api --method POST \
35+
-H "Accept: application/vnd.github+json" \
36+
-H "X-GitHub-Api-Version: 2022-11-28" \
37+
/repos/${GITHUB_REPOSITORY}/releases/generate-notes \
38+
-f tag_name="${{ steps.release-version.outputs.tag }}" \
39+
-f target_commitish="${GITHUB_REF_NAME}" \
40+
-f previous_tag_name="${{ steps.previous-version.outputs.tag }}" | jq -r .body > charts/cryostat/release-notes.md
41+
- name: Run chart-releaser
42+
uses: helm/chart-releaser-action@v1.5.0
43+
env:
44+
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
45+
with:
46+
version: v1.5.0
47+
charts_dir: charts
48+
config: .github/helm-release-config.yml

.github/workflows/release-drafter.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

charts/cryostat/release-notes.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<!-- Release notes generated using configuration in .github/release.yml -->

0 commit comments

Comments
 (0)