Repository navigation
feat(infra): update the deployment script #163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
3cf441f
fix(release): update the release script
Ayush8923 2022ba1
Merge branch 'main' of https://github.com/ProjectTech4DevAI/kaapi-gua…
Ayush8923 f02e2f1
Merge branch 'main' of https://github.com/ProjectTech4DevAI/kaapi-gua…
Ayush8923 1c524c8
Merge branch 'main' of https://github.com/ProjectTech4DevAI/kaapi-gua…
Ayush8923 89f4390
feat(*): update the infra deployment script
Ayush8923 71859c2
fix(*): update the secrets
Ayush8923 af20059
fix(*): trigger the flow in push event for testing
Ayush8923 ba856e3
fix(*): update the env type
Ayush8923 93a1a88
fix(*): incrase the timeout minutes
Ayush8923 8dfe74e
fix(*): remove the push event from the deploy staging file
Ayush8923 a7d90cd
Merge branch 'main' into feat/deployment-script-updates
Ayush8923 fd49ce2
fix(*): build init
Ayush8923 bcedff6
fix(*): revert the last changes
Ayush8923 e7d3aa9
fix(*): update the workflow nae
Ayush8923 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| name: Discord deploy notification | ||
| description: Post a green (healthy) or red (failed) deploy-status embed to Discord. | ||
|
|
||
| inputs: | ||
| webhook-url: | ||
| description: Discord webhook URL. When empty, the step is a no-op. | ||
| required: true | ||
| name: | ||
| description: Deploy target name shown in the title (e.g. kaapi-staging). | ||
| required: true | ||
| release: | ||
| description: Release identifier (tag or run number). | ||
| required: true | ||
| sha: | ||
| description: Full commit SHA; truncated to 7 chars for display. | ||
| required: true | ||
| run-url: | ||
| description: Link to the workflow run. | ||
| required: true | ||
| ok: | ||
| description: "'true' for a healthy deploy; anything else renders as failed." | ||
| required: true | ||
| failure-reason: | ||
| description: Optional extra line explaining a failure (e.g. CI blocked the release). | ||
| required: false | ||
| default: "" | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - shell: bash | ||
| env: | ||
| DISCORD_WEBHOOK_URL: ${{ inputs.webhook-url }} | ||
| NAME: ${{ inputs.name }} | ||
| RELEASE: ${{ inputs.release }} | ||
| SHA: ${{ inputs.sha }} | ||
| RUN_URL: ${{ inputs.run-url }} | ||
| OK: ${{ inputs.ok }} | ||
| REASON: ${{ inputs.failure-reason }} | ||
| run: | | ||
| [ -z "$DISCORD_WEBHOOK_URL" ] && { echo "No webhook configured, skipping"; exit 0; } | ||
| if [ "$OK" = "true" ]; then | ||
| TITLE="🟢 $NAME deployment healthy"; COLOR=3066993 # green | ||
| else | ||
| TITLE="🔴 $NAME deployment failed"; COLOR=15158332 # red | ||
| fi | ||
| SHA_SHORT=$(echo "$SHA" | cut -c1-7) | ||
|
|
||
| fields=$(jq -n --arg release "$RELEASE" --arg sha "$SHA_SHORT" \ | ||
| '[{name:"Release",value:$release,inline:true},{name:"SHA",value:$sha,inline:true}]') | ||
| # Only a failed deploy with a stated cause gets the extra Reason line. | ||
| if [ "$OK" != "true" ] && [ -n "$REASON" ]; then | ||
| fields=$(echo "$fields" | jq --arg r "$REASON" '. + [{name:"Reason",value:$r,inline:false}]') | ||
| fi | ||
|
|
||
| payload=$(jq -n --arg title "$TITLE" --argjson color "$COLOR" \ | ||
| --arg url "$RUN_URL" --argjson fields "$fields" \ | ||
| '{embeds:[{title:$title,url:$url,color:$color,fields:$fields,timestamp:(now|todate)}]}') | ||
| curl -sf -H "Content-Type: application/json" -X POST -d "$payload" "$DISCORD_WEBHOOK_URL" \ | ||
| || echo "Discord notification failed to send" | ||
This file contains hidden or 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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use
exit 1if the webhook notification fails and include a reason indicating that the webhook failed?