feat: update K8s Health Agent to the latest released version #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release K8s Health Agent Charts | |
on: | |
workflow_dispatch: | |
push: | |
branches: ['main'] | |
paths: ['k8s-health-agent/Chart.yaml'] | |
env: | |
GITHUB_TOKEN: "${{ secrets.CR_TOKEN }}" | |
CR_TOKEN: "${{ secrets.CR_TOKEN }}" | |
jobs: | |
release: | |
permissions: | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "syntassodev" | |
git config user.email "[email protected]" | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
- name: Run chart-releaser | |
uses: helm/[email protected] | |
with: | |
charts_dir: . | |
pages_branch: gh-pages | |
skip_existing: true | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-region: eu-west-2 | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- name: Upload Charts to Releases Bucket | |
run: | | |
VERSION=$(grep '^version:' k8s-health-agent/Chart.yaml | awk '{print $2}' | head -n 1) | |
bucket_path="s3://syntasso-enterprise-releases/k8s-health-agent-helm-chart/${VERSION}/" | |
if [ -f .cr-release-packages/k8s-health-agent-${VERSION}.tgz ]; then | |
echo "Uploading k8s-health-agent-${VERSION}.tgz to ${bucket_path}" | |
aws s3 cp .cr-release-packages/k8s-health-agent-${VERSION}.tgz ${bucket_path} | |
else | |
echo "No new package created, skipping upload" | |
fi | |
- name: Update SKE Destination Helm | |
run: | | |
if [ -f .cr-release-packages/k8s-health-agent-${VERSION}.tgz ]; then | |
echo "Updating Chart.yaml in ske-destination" | |
export current_k8s_health_agent_version="$(yq -r '.version' k8s-health-agent/Chart.yaml)" | |
current_ske_destination_chart_version="$(yq -r '.version' ske-destination/Chart.yaml)" | |
export new_ske_destination_chart_version="$(echo $current_ske_destination_chart_version | awk -F. '{$2 = $2 + 1;} 1' | sed 's/ /./g')" | |
yq -i '.version = env(new_ske_destination_chart_version)' ske-destination/Chart.yaml | |
yq -i '.dependencies[1].version = env(current_k8s_health_agent_version)' ske-destination/Chart.yaml | |
else | |
echo "No new package created, skipping update to Chart.yaml in ske-destination" | |
fi | |
- name: Commit and push changes | |
run: | | |
if [ -z "$(git status --porcelain)" ]; then | |
echo "no changes to commit; exiting" | |
exit 0 | |
fi | |
git add . | |
git commit -m "feat: update K8s Health Agent in SKE Destination chart" | |
git push |