production #287
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: Helm Chart Latest App Version Release | |
on: | |
deployment: | |
concurrency: | |
group: Helm Chart Latest App Version Release | |
env: | |
service: ${{ github.event.deployment.payload.service }} | |
major_minor_patch: ${{ github.event.deployment.payload.major_minor_patch }} | |
app_version: ${{ github.event.deployment.payload.app_version }} | |
jobs: | |
update-latest-helm-chart-version: | |
if: github.event.deployment.task == 'update-latest-version' | |
runs-on: ubuntu-20.04 | |
outputs: | |
new_chart_version: ${{ steps.vars.outputs.new_chart_version }} | |
chart_name: ${{ steps.vars.outputs.chart_name }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.AKEYLESS_CI_COMMIT_PUSH_TOKEN }} | |
- name: Fetch history | |
run: git fetch --prune --unshallow | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
- name: Update latest helm chart version | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github.event.deployment) }} | |
run: .github/scripts/latest_version_release.sh | |
- name: Set Change Variables | |
id: vars | |
run: | | |
echo new_chart_version=${{ env.new_chart_version }} >> $GITHUB_OUTPUT | |
echo chart_name=${{ env.chart_name }} >> $GITHUB_OUTPUT | |
- uses: actions/github-script@v7 | |
with: | |
github-token: ${{ secrets.AKEYLESS_CI_COMMIT_PUSH_TOKEN }} | |
script: | | |
await github.rest.actions.createWorkflowDispatch({ | |
owner: 'akeylesslabs', | |
repo: 'akeyless-k8s-manifests', | |
workflow_id: 'update-chart.yml', | |
ref: 'main' | |
}) | |
Slack-Notification-on-success: | |
name: Slack-On-Success-Notification | |
runs-on: ubuntu-20.04 | |
needs: [ update-latest-helm-chart-version ] | |
if: (github.event.deployment.task == 'update-latest-version') | |
env: | |
new_chart_version: ${{ needs.update-latest-helm-chart-version.outputs.new_chart_version }} | |
chart_name: ${{ needs.update-latest-helm-chart-version.outputs.chart_name }} | |
steps: | |
- name: Prepare Slack Message On Success | |
id: slack-message-success-creator | |
run: | | |
SLACK_MESSAGE="*Service:* $service | |
*Bump version:* $major_minor_patch | |
*App Version:* $app_version | |
*Chart:* $chart_name | |
*New Chart Version:* $new_chart_version | |
:helm:" | |
delimiter="$(openssl rand -hex 8)" | |
echo "slack-message<<${delimiter}" >> $GITHUB_ENV | |
echo "${SLACK_MESSAGE//$/%0A}" >> $GITHUB_ENV | |
echo "${delimiter}" >> $GITHUB_ENV | |
- name: Slack Success Notification | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: 'operations' | |
SLACK_COLOR: ${{ job.status }} | |
SLACK_ICON: https://github.com/rtCamp.png?size=48 | |
SLACK_TITLE: Helm Chart Latest Version Release Updated | |
SLACK_MESSAGE: '${{ env.slack-message }}' | |
SLACK_USERNAME: githubBot | |
SLACK_WEBHOOK: ${{ secrets.SLACK_OPERATIONS_WEBHOOK }} | |
MSG_MINIMAL: true | |
SLACK_FOOTER: Akeyless.io Helm Chart Latest Version Release | |
Slack-Notification-on-failure: | |
name: Slack-On-Failure-Notification | |
runs-on: ubuntu-20.04 | |
needs: [ update-latest-helm-chart-version ] | |
if: (failure() && needs.*.result != 'success') && (github.event.deployment.task == 'update-latest-version') | |
env: | |
chart_name: ${{ needs.update-latest-helm-chart-version.outputs.chart_name }} | |
steps: | |
- name: Prepare Slack Message On Failure | |
id: slack-message-failure-creator | |
run: | | |
SLACK_MESSAGE="*Service:* $service | |
*Bump version:* $major_minor_patch | |
*App Version:* $app_version | |
*Chart:* $chart_name | |
*Status:* Failure | |
:terminator:" | |
delimiter="$(openssl rand -hex 8)" | |
echo "slack-message<<${delimiter}" >> $GITHUB_ENV | |
echo "${SLACK_MESSAGE//$/%0A}" >> $GITHUB_ENV | |
echo "${delimiter}" >> $GITHUB_ENV | |
- name: Slack Failure Notification | |
uses: rtCamp/action-slack-notify@v2 | |
env: | |
SLACK_CHANNEL: 'operations' | |
SLACK_COLOR: '#bd3232' | |
SLACK_ICON: https://github.com/rtCamp.png?size=48 | |
SLACK_TITLE: Helm Chart Latest Version Release Failed! | |
SLACK_MESSAGE: '${{ env.slack-message }}' | |
SLACK_USERNAME: githubBot | |
SLACK_WEBHOOK: ${{ secrets.SLACK_OPERATIONS_WEBHOOK }} | |
SLACK_FOOTER: Akeyless.io Helm Chart Latest Version Release |