Skip to content

Update Helm AppVersion #243

Update Helm AppVersion

Update Helm AppVersion #243

name: Update Helm AppVersion
on:
workflow_run:
workflows: ["Build and Push Docker Images"]
types:
- completed
jobs:
update-appversion:
if: >-
${{ github.event.workflow_run.conclusion == 'success' && !contains(github.event.workflow_run.head_commit.message, '[skip ci]') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
ref: ${{ github.event.workflow_run.head_sha }}
- name: Get short commit SHA
id: vars
run: echo "sha=sha-$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Get all changed postgres/ files
id: changed_postgres_files
uses: tj-actions/changed-files@v47
with:
files: |
postgres/**
# Only bumped if there are changes in the postgres directory.
- name: Update appVersion in cortex-postgres Chart.yaml
if: steps.changed_postgres_files.outputs.all_changed_files != ''
run: |
sed -i 's/^\([ ]*appVersion:[ ]*\).*/\1"${{ steps.vars.outputs.sha }}"/' helm/library/cortex-postgres/Chart.yaml
- name: Commit and push changes for cortex-postgres
if: steps.changed_postgres_files.outputs.all_changed_files != ''
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add helm/library/cortex-postgres/Chart.yaml
git commit -m "Bump cortex-postgres chart appVersions to ${{ steps.vars.outputs.sha }} [skip ci]" || echo "No changes to commit"
git push origin HEAD:main
- name: Update appVersion in dist/chart/Chart.yaml
run: |
sed -i 's/^\([ ]*appVersion:[ ]*\).*/\1"${{ steps.vars.outputs.sha }}"/' dist/chart/Chart.yaml
- name: Commit and push changes for cortex
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add dist/chart/Chart.yaml
git commit -m "Bump cortex chart appVersions to ${{ steps.vars.outputs.sha }} [skip ci]" || echo "No changes to commit"
git push origin HEAD:main