Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split pipelines #89

Merged
merged 2 commits into from
Jun 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
71 changes: 71 additions & 0 deletions .github/workflows/create-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Create chart release

on:
push:
branches:
- main

permissions:
contents: write

env:
COMMITTER_NAME: "txqueuelen release bot"
COMMITTER_EMAIL: [email protected]

jobs:
release:
name: Create chart release
runs-on: ubuntu-latest
steps:
- 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
72 changes: 6 additions & 66 deletions .github/workflows/publish-charts.yaml
Original file line number Diff line number Diff line change
@@ -1,90 +1,30 @@
name: Publish chart

on:
push:
branches:
- main
release:
types:
- released

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:
- 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.
- uses: actions/checkout@v4
- 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.version.outputs.next-version }}"
helm package charts/stateless-dns -u --version "${GITHUB_REF_NAME#v}"
- name: Helm push
if: ${{ steps.empty.outputs.is-empty == 'false' && steps.held.outputs.is-held == 'false' }}
run: |
helm push \
"stateless-dns-${{ steps.version.outputs.next-version }}.tgz" \
"stateless-dns-${GITHUB_REF_NAME#v}.tgz" \
"oci://ghcr.io/${GITHUB_REPOSITORY_OWNER}/pdns-stateless"
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## Unreleased

### Enhancement
- Split release process so we can create off-tree emergency releases

## v0.4.1 - 2024-06-18

### ⛓️ Dependencies
Expand All @@ -11,10 +14,15 @@

### Note
All the previous release contain no changelog as it was no automation.

I am solving this with this PR/release/automation that automates the generation of change logs and releases.

I am leveraging this 0ver to do a breaking change. I am changing the URL for this chart from oci://ghcr.io/txqueuelen/charts to oci://ghcr.io/txqueuelen/pdns-stateless.

It seemed that is awesome to have all charts on the same path and loved that Github supported it but I found that is hard to follow the origin of a chart. Users expect to have the chart in a repository called `charts`.

This breaking change should not affect too much as almost no user is using this release note is a way of documenting the changes.

Luckily there are only a few 0ver releases from here once we merge all dependencies that need to be upgraded and make the last changes before creating the v1 release :D

### 🚀 Enhancements
Expand Down
Loading