Skip to content

trigger-workflow-testkube-cloud-api #292

trigger-workflow-testkube-cloud-api

trigger-workflow-testkube-cloud-api #292

name: Release Helm Chart - dispatch
on:
repository_dispatch:
types: [trigger-workflow-testkube-cloud-api, trigger-workflow-testkube-cloud-ui]
jobs:
release-helm-charts:
name: Release Helm Charts
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install yq
uses: mikefarah/yq@v4
- name: Install Helm
uses: azure/setup-helm@v3
- name: Update Helm chart
run: |
./scripts/update.sh \
-c ${{ github.event.client_payload.app }} \
-a ${{ github.event.client_payload.appVersion }} \
--verbose
echo -e "### ${{ github.event.client_payload.app }} Helm chart diff" >> $GITHUB_STEP_SUMMARY
echo -e '```' >> $GITHUB_STEP_SUMMARY
git --no-pager diff >> $GITHUB_STEP_SUMMARY
echo -e '```' >> $GITHUB_STEP_SUMMARY
chart_version=$(./scripts/update.sh -c ${{ github.event.client_payload.app }} --print-chart-version)
echo "CHART_VERSION=$chart_version" >> $GITHUB_ENV
- name: Update Testkube Enterprise Helm chart
run: |
echo "Syncing subchart versions in testkube-enterprise Helm chart"
./scripts/sync.sh
echo -e "### Testkube Enterprise Helm chart diff" >> $GITHUB_STEP_SUMMARY
echo -e '```' >> $GITHUB_STEP_SUMMARY
git --no-pager diff charts/testkube-enterprise >> $GITHUB_STEP_SUMMARY
echo -e '```' >> $GITHUB_STEP_SUMMARY
enterprise_chart_version=$(./scripts/update.sh -c testkube-enterprise --print-chart-version)
echo "ENTERPRISE_CHART_VERSION=$enterprise_chart_version" >> $GITHUB_ENV
- name: Lint Helm charts for safety
run: |
helm lint charts/*
- name: Package charts & update Helm repo index
run: |
echo "Packaging ${{ github.event.client_payload.app }} chart"
helm package charts/${{ github.event.client_payload.app }} --destination charts
echo "Packaging testkube-enterprise chart"
helm package charts/testkube-enterprise --destination charts
helm repo index .
- name: Commit & push changes
run: |
git config --global user.name "testkube-cloud-ci-bot"
git config --global user.email "testkube-cloud-ci-bot@users.noreply.github.com"
git status
git add .
git commit -m "updating chart ${{ github.event.client_payload.app }} version to "${{ env.CHART_VERSION }}" and appVersion to ${{ github.event.client_payload.appVersion }}; Updating testkube-enterprise chart version to ${{ env.ENTERPRISE_CHART_VERSION }}."
git push
- name: Bump version and push tag
id: tag
uses: anothrNick/github-tag-action@1.64.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
WITH_V: true
DEFAULT_BUMP: patch
- name: Changelog
uses: scottbrenner/generate-changelog-action@master
id: changelog
- name: Create a GitHub release
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag.outputs.new_tag }}
name: ${{ steps.tag.outputs.new_tag }}
body: ${{ steps.changelog.outputs.changelog }}
artifacts: |
charts/*.tgz
- name: Release to Keygen
uses: getgrit/keygen-action@main
with:
# Required: Keygen Account ID or slug
account-id: "${{ secrets.KEYGEN_ACCOUNT_ID }}"
# Required: A Product or User Token (ref. https://keygen.sh/docs/api/authentication/#token-authentication)
token: "${{ secrets.KEYGEN_TESTKUBE_ENTERPRISE_PRODUCT_TOKEN }}"
# Required: Product ID
product-id: "${{ secrets.KEYGEN_TESTKUBE_ENTERPRISE_PRODUCT_ID }}"
# Required (boolean): true to publish the created release; false to keep it in the DRAFT state.
release-publish: true
# Optional
release-name: 'Testkube Enterprise v${{ env.ENTERPRISE_CHART_VERSION }}'
# Required: must be a valid semver value, without the `v` prefix
release-version: '${{ env.ENTERPRISE_CHART_VERSION }}'
# Required
release-channel: 'stable'
# Optional
release-tag: 'latest'
artifacts-json: |
[
{
"filepath": "./charts/testkube-enterprise-${{ env.ENTERPRISE_CHART_VERSION }}.tgz",
"platform": "linux",
"arch": "amd64"
}
]