Skip to content

Fix platform image version (#37) #70

Fix platform image version (#37)

Fix platform image version (#37) #70

Workflow file for this run

name: Release Charts
on:
push:
branches: [master]
paths:
- charts/**
workflow_dispatch:
jobs:
release_charts:
permissions:
contents: write # to push chart release and create a release (helm/chart-releaser-action)
runs-on: ubuntu-latest
outputs:
changed_charts: ${{ steps.chart-releaser.outputs.changed_charts }}
steps:
- name: Checkout Code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Fetch history
run: git fetch --prune --unshallow
- name: Configure Git
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "[email protected]"
- name: Set up Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.12.0
- name: Add dependency chart repos
run: |
helm repo add prometheus-community https://prometheus-community.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 }}"
CR_SKIP_EXISTING: true
generate_release_notes:
runs-on: ubuntu-latest
needs: release_charts
if: needs.release_charts.outputs.changed_charts
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
fetch-depth: 0
- name: Generate release notes for the released charts
env:
GH_TOKEN: ${{ github.token }}
run: |
set -x
released_charts_paths="${{ needs.release_charts.outputs.changed_charts }}"
echo "Released charts: ${released_charts}"
# Generate release notes for each chart.
IFS=',' read -ra charts_paths <<< "$released_charts_paths"
for chart_path in "${charts_paths[@]}"; do
chart_name=$(echo "$chart_path" | cut -d'/' -f2)
# Fetch latest and previous tag
tags=($(git tag --list "${chart_name}-[0-9]*.[0-9]*.[0-9]*" | sort -r | head -n 2))
latest_tag="${tags[0]}"
previous_tag="${tags[1]}"
if [[ -z "$latest_tag" ]]; then
echo "Unable to fetch latest tag for chart `$chart_name`"
exit 1
else
# Get release notes for chart
gh api \
/repos/${{ github.repository }}/releases/generate-notes \
-f tag_name=${latest_tag} \
-f target_commitish=master \
-f previous_tag_name=${previous_tag} | jq -r '.body' > $chart_path/RELEASE_NOTES.md
# Update release notes for the chart release
if [ -f "$chart_path/RELEASE_NOTES.md" ]; then
gh release edit ${latest_tag} --notes-file $chart_path/RELEASE_NOTES.md
else
echo "$chart_path/RELEASE_NOTES.md does not exist"
exit 1
fi
fi
done