Skip to content

🔥 chore: bump for fun and profit 💸 #15

🔥 chore: bump for fun and profit 💸

🔥 chore: bump for fun and profit 💸 #15

Workflow file for this run

name: Release Charts
on:
push:
branches:
- main
paths:
- 'charts/**'
# Only allow 1 release at a time (avoid concurent deployment to gh-pages)
concurrency: "release-chart"
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Install Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3
# Needed for subchart dependencies
- name: Add jenkins-infra Helm repository
run: helm repo add jenkins-infra https://jenkins-infra.github.io/helm-charts
- name: Run chart-releaser
id: chart_releaser
uses: helm/chart-releaser-action@a917fd15b20e8b64b94d9158ad54cd6345335584 # v1.6.0
env:
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Update modified chart release(s)
id: update_chart_releases
if: steps.chart_releaser.outputs.changed_charts != ''
run: |
# KISS, last commit subject as changelog for every modified chart
changelog=$(git log --format=%s -n 1)
echo "= changelog: ${changelog}"
# Set IFS to a comma to split the string into an array
IFS=',' read -ra changedCharts <<< "${{ steps.chart_releaser.outputs.changed_charts }}"
for chart in "${changedCharts[@]}"; do
chartName=$(echo "${chart}" | cut -d '/' -f 2)
echo "= chartName: ${chartName}"
# Retrieve version from Chart.yaml
version=$(yq '.version' "${chart}/Chart.yaml")
echo "= version: ${version}"
tag="${chartName}-${version}"
echo "= tag: ${tag}"
# Retrive release id and body from tag
release=$(curl -L "https://api.github.com/repos/${{ github.repository }}/releases/tags/${tag}")
releaseId=$(echo "${release}" | jq --raw-output '.id')
echo "= releaseId: ${releaseId}"
releaseBody=$(echo "${release}" | jq --raw-output '.body')
echo "= releaseBody: ${releaseBody}"
# Update release
newlines="\r\n\r\n"
body="${releaseBody}${newlines}## Changelog${newlines}${changelog}"
echo "= body:"
echo "${body}"
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/repos/${{ github.repository }}/releases/${releaseId}" \
-d "{\"body\":\"${body}\"}"
done