-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: refactor workflows and add actions
- Loading branch information
1 parent
c0b557e
commit 6606cfe
Showing
12 changed files
with
584 additions
and
329 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: "Extract Pull Request Number" | ||
|
||
description: "Extract the pull request number that triggered the workflow." | ||
|
||
outputs: | ||
pr-number: | ||
description: "The pull request number that triggered the workflow." | ||
value: ${{ steps.extract-pr-number.outputs.pr-number }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Get pull request number | ||
id: extract-pr-number | ||
shell: bash | ||
run: | | ||
# Retrieve the pull request number | ||
PR_NUMBER="${{ github.event.pull_request.number }}" | ||
echo "Extracted pull request number: $PR_NUMBER" | ||
# Set the pull request number as output | ||
echo "pr-number=$PR_NUMBER" >> $GITHUB_OUTPUT |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: Slack Notification | ||
description: Send Slack notification for success or failure with deployment details | ||
|
||
inputs: | ||
app-name: | ||
description: 'Name of the app being deployed' | ||
required: true | ||
deployment-url: | ||
description: 'URL of the deployed app (output from a previous job)' | ||
required: true | ||
deployment-status: | ||
description: 'Status of the deployment (success or failure)' | ||
required: true | ||
slack-channel-id: | ||
description: 'Slack channel to send notifications' | ||
required: true | ||
slack-notifications-webhook-url: | ||
description: 'Slack webhook URL for sending notifications' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Map app name to Vercel project | ||
shell: bash | ||
id: vercel-project | ||
run: | | ||
if [ "${{ inputs.app-name }}" == "Unified-web App" ]; then | ||
echo "project-name=dfds-unified-web" >> $GITHUB_OUTPUT | ||
elif [ "${{ inputs.app-name }}" == "Login App" ]; then | ||
echo "project-name=unified-web-login" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Set Slack notification message | ||
shell: bash | ||
id: set-message | ||
run: | | ||
if [ "${{ inputs.deployment-status }}" == "failure" ]; then | ||
echo "message=Deployment failed* :fire_engine:\nThe deployment triggered by *${{ github.actor }}* failed." >> $GITHUB_OUTPUT | ||
echo "text=GitHub Action failed" >> $GITHUB_OUTPUT | ||
elif [ "${{ inputs.deployment-status }}" == "success" ]; then | ||
echo "message=Deployment succeeded* :rocket:\n*${{ github.actor }}* triggered a successful deployment.\nYou can access the deployed app here: <${{ inputs.deployment-url }}>" >> $GITHUB_OUTPUT | ||
echo "text=GitHub Action success" >> $GITHUB_OUTPUT | ||
fi | ||
- name: Notify Slack | ||
uses: slackapi/slack-github-action@v1.27.0 | ||
with: | ||
channel-id: ${{ inputs.slack-channel-id }} | ||
payload: | | ||
{ | ||
"text": "${{ steps.set-message.outputs.text }}", | ||
"blocks": [ | ||
{ | ||
"type": "section", | ||
"text": { | ||
"type": "mrkdwn", | ||
"text": "*${{ inputs.app-name }} - ${{ steps.set-message.outputs.message }}" | ||
} | ||
}, | ||
{ | ||
"type": "actions", | ||
"elements": [ | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": ":github: View action" | ||
}, | ||
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | ||
}, | ||
{ | ||
"type": "button", | ||
"text": { | ||
"type": "plain_text", | ||
"text": "View deployments" | ||
}, | ||
"url": "https://vercel.com/<organization>/${{ steps.vercel-project.outputs.project-name }}/deployments" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ inputs.slack-notifications-webhook-url }} | ||
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
name: Contentful Webhook - Redeploy apps | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
unified-web-app-preview-deployment: | ||
name: Deploy Unified-web App (Vercel Preview) | ||
uses: ./.github/workflows/reusable-vercel-deploy.yml | ||
with: | ||
app-name: 'Unified-web App' | ||
github-environment: 'dev' | ||
vercel-environment: 'preview' | ||
domains: | | ||
${{ needs.get-pr-number.outputs.pr-number }}-deployment-domain.vercel.app | ||
secrets: inherit |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.