Skip to content

Bump Platform operator image (#46) #82

Bump Platform operator image (#46)

Bump Platform operator image (#46) #82

Workflow file for this run

name: Release Charts
on:
push:
branches: [master]
paths:
- charts/**
workflow_dispatch:
jobs:
find-charts-to-release:
runs-on: ubuntu-latest
outputs:
changed_charts: ${{ steps.list-changed-charts.outputs.all_modified_files }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
fetch-depth: 0
- name: Get list of changed charts
id: list-changed-charts
uses: tj-actions/changed-files@77af4bed286740ef1a6387dc4e4e4dec39f96054 # v43
with:
files: charts/*/Chart.yaml
release-charts:
permissions:
contents: write # to push chart release and create a release (helm/chart-releaser-action)
runs-on: ubuntu-latest
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
with:
mark_as_latest: false
generate-release-notes:
runs-on: ubuntu-latest
needs:
- find-charts-to-release
- release-charts
if: ${{ needs.find-charts-to-release.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_chart_files="${{ needs.find-charts-to-release.outputs.changed_charts }}"
echo "Released chart files: ${released_chart_files}"
# Generate release notes for each chart.
IFS=',' read -ra chart_files <<< "$released_chart_files"
for chart_file in "${chart_files[@]}"; do
chart_name=$(echo "$chart_file" | 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
release_notes="charts/$chart_name/RELEASE_NOTES.md"
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' > $release_notes
# Update release notes for the chart release
if [ -f "$release_notes" ]; then
gh release edit ${latest_tag} --notes-file $release_notes
else
echo "$release_notes does not exist"
exit 1
fi
fi
done