-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Juan Manuel "Kang" Perez
committed
Jun 23, 2024
1 parent
b932b61
commit 56f8cb6
Showing
3 changed files
with
66 additions
and
87 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,90 @@ | ||
name: Publish chart | ||
|
||
on: | ||
release: | ||
types: | ||
- released | ||
push: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: write | ||
packages: write | ||
|
||
env: | ||
COMMITTER_NAME: "txqueuelen release bot" | ||
COMMITTER_EMAIL: [email protected] | ||
|
||
jobs: | ||
release: | ||
name: Publish chart to OCI registry | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
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' }} | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
git add CHANGELOG.md | ||
git config user.name '${{ env.COMMITTER_NAME }}' | ||
git config user.email '${{ env.COMMITTER_EMAIL }}' | ||
git commit -m "[no ci] Automatic ${{ steps.version.outputs.next-version }} release" | ||
git push | ||
gh release create "${{ steps.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 "${GITHUB_REF_NAME#v}" | ||
helm package charts/stateless-dns -u --version "${{ steps.version.outputs.next-version }}" | ||
- name: Helm push | ||
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }} | ||
run: | | ||
helm push \ | ||
"stateless-dns-${GITHUB_REF_NAME#v}.tgz" \ | ||
"stateless-dns-${{ steps.version.outputs.next-version }}.tgz" \ | ||
"oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/pdns-stateless" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters