-
Notifications
You must be signed in to change notification settings - Fork 2
82 lines (75 loc) · 3.18 KB
/
publish-charts.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
name: Publish chart
on:
push:
branches:
- main
permissions:
contents: write
packages: write
jobs:
release:
name: Publish chart to OCI registry
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
# Create release-toolkit data file and hydrate it.
- name: Generate changelog YAML
uses: newrelic/release-toolkit/generate-yaml@v1
with:
excluded-dirs: .github
excluded-files: README.md
exit-code: "0"
# Check if we have something to release and if the release is not blocked.
- name: Check if the release is empty
id: empty
uses: newrelic/release-toolkit/is-empty@v1
- name: Check if the release is held
id: held
uses: newrelic/release-toolkit/is-held@v1
# Calculate next-version and generate change logs
- name: Link dependencies
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }}
uses: newrelic/release-toolkit/link-dependencies@v1
with:
dictionary: .github/rt-dictionary.yaml
- name: Calculate next version
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }}
id: version
uses: newrelic/release-toolkit/next-version@v1
- name: Generate release notes
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }}
uses: newrelic/release-toolkit/render@v1
- name: Update CHANGELOG.md
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }}
uses: newrelic/release-toolkit/update-markdown@v1
with:
version: ${{ steps.version.outputs.next-version }}
# Commit to main branch and push changes. Then create a release.
- name: Commit and tag release
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }}
run: |
git add CHANGELOG.md
git commit -m "[no ci] Automatic ${{ steps.next-version.outputs.next-version }} release"
git push
gh release create "${{ steps.next-version.outputs.next-version }}" -F CHANGELOG.partial.md
# Login to GitHub Packages to upload the chart to the OCI repository.
- name: Helm login
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
helm registry login ghcr.io \
--username "$GITHUB_REPOSITORY_OWNER" \
--password-stdin
- name: Helm package
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }}
run: |
helm package charts/stateless-dns -u --version "${{ steps.next-version.outputs.version }}"
- name: Helm push
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }}
run: |
helm push \
"stateless-dns-${{ steps.next-version.outputs.version }}.tgz" \
"oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/pdns-stateless"