Repository navigation
chore(deployment): Improve build process #292
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
9 commits
Select commit
Hold shift + click to select a range
1ddda05
feat(*): update the deployment script
Ayush8923 458b0d9
fix(*): remove the unwanted comments
Ayush8923 cc12ff3
fix(*): script updates
Ayush8923 e9dbba3
fix(*): update workflow name
Ayush8923 cdb9a9c
fix(*): initiate build
Ayush8923 92e0457
fix(*): update the variable name
Ayush8923 2a5e7f5
fix(*): initiate build
Ayush8923 b6215c6
fix(*): revert the last changes
Ayush8923 3d359f0
fix(*): remove the unwanted echo
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 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
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.
Just wanted to check if we should use
exit 1here when the Discord notification fails to send. This way, we can at least flag that something went wrong with the webhook, even if the deployment itself was healthy.If this behavior is intentional, feel free to ignore my comment.