-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: slack notification for release to production (gh-action) (#5083)
* docs: slack notif draft for release gh-action * docs: amend slack notif description * docs: add slack notification for all jobs in release * docs: try ubuntu as runs-on * docs: set runs-on tags back * docs: fix URL formatting for slack notif * docs: remove test failure step * docs: add current step failure logic * docs: fix indentation * docs: add some step failures * docs: remove force failure * Apply suggestions from code review Co-authored-by: Karl Cardenas <[email protected]> --------- Co-authored-by: Karl Cardenas <[email protected]>
- Loading branch information
1 parent
853ac7f
commit 4182f12
Showing
1 changed file
with
53 additions
and
7 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 |
---|---|---|
|
@@ -57,10 +57,13 @@ jobs: | |
node-version: "20" | ||
cache: "npm" | ||
|
||
- run: npm ci | ||
|
||
- run: | | ||
echo "CURRENT_STEP=npm ci" >> $GITHUB_ENV | ||
npm ci | ||
- name: Build | ||
run: | | ||
echo "CURRENT_STEP=Build" >> $GITHUB_ENV | ||
touch .env | ||
make versions-ci | ||
make build-ci | ||
|
@@ -73,10 +76,24 @@ jobs: | |
|
||
- name: Upload to AWS | ||
run: | | ||
echo "CURRENT_STEP=Upload to AWS" >> $GITHUB_ENV | ||
aws s3 sync --cache-control 'public, max-age=604800' --exclude '*.html' --exclude '*.xml' --exclude build/scripts/ build/ s3://docs.spectrocloud.com --delete | ||
aws s3 sync --cache-control 'public, max-age=0, s-maxage=604800' build/ s3://docs.spectrocloud.com --delete | ||
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*" | ||
- name: Slack Notification on Failure | ||
if: ${{ failure() }} | ||
uses: rtCamp/[email protected] | ||
env: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_PRIVATE_TEAM_WEBHOOK }} | ||
SLACK_USERNAME: "spectromate" | ||
SLACK_ICON_EMOJI: ":robot_panic:" | ||
SLACK_COLOR: "danger" | ||
SLACKIFY_MARKDOWN: true | ||
ENABLE_ESCAPES: true | ||
SLACK_MESSAGE: "The self-hosted runner release job for `${{ github.workflow }}` in `${{ github.repository }}` failed at step: `${{ env.CURRENT_STEP }}`. [View details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." | ||
|
||
|
||
# Use this workflow if you want to use the GitHub-hosted large runner. Useful for scenarios when you need a change to deploy faster than the self-hosted runner can build it. | ||
build-large-runner: | ||
if: ${{ github.event.inputs.useGitHubHostedLargeRunner == 'true' && github.event_name != 'schedule' }} | ||
|
@@ -98,13 +115,14 @@ jobs: | |
node-version: "20" | ||
cache: "npm" | ||
|
||
- run: npm ci | ||
- run: | | ||
echo "CURRENT_STEP=npm ci" >> $GITHUB_ENV | ||
npm ci | ||
- name: Versions | ||
run: | | ||
- name: Build | ||
run: | | ||
echo "CURRENT_STEP=Build" >> $GITHUB_ENV | ||
touch .env | ||
make versions-ci | ||
make build-ci | ||
|
@@ -117,10 +135,22 @@ jobs: | |
|
||
- name: Upload to AWS | ||
run: | | ||
echo "CURRENT_STEP=Upload to AWS" >> $GITHUB_ENV | ||
aws s3 sync --cache-control 'public, max-age=604800' --exclude '*.html' --exclude '*.xml' --exclude build/scripts/ build/ s3://docs.spectrocloud.com --delete | ||
aws s3 sync --cache-control 'public, max-age=0, s-maxage=604800' build/ s3://docs.spectrocloud.com --delete | ||
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*" | ||
- name: Slack Notification on Failure | ||
if: ${{ failure() }} | ||
uses: rtCamp/[email protected] | ||
env: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_PRIVATE_TEAM_WEBHOOK }} | ||
SLACK_USERNAME: "spectromate" | ||
SLACK_ICON_EMOJI: ":robot_panic:" | ||
SLACK_COLOR: "danger" | ||
SLACKIFY_MARKDOWN: true | ||
ENABLE_ESCAPES: true | ||
SLACK_MESSAGE: "The large runner release job for `${{ github.workflow }}` in `${{ github.repository }}` failed at step: `${{ env.CURRENT_STEP }}`. [View details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." | ||
|
||
release: | ||
name: "Release" | ||
|
@@ -152,9 +182,25 @@ jobs: | |
cache: "npm" | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
run: | | ||
echo "CURRENT_STEP=Install dependencies" >> $GITHUB_ENV | ||
npm ci | ||
- name: "release" | ||
env: | ||
GITHUB_TOKEN: ${{ steps.import-secrets.outputs.VAULT_GITHUB_TOKEN }} | ||
run: npx semantic-release | ||
run: | | ||
echo "CURRENT_STEP=release" >> $GITHUB_ENV | ||
npx semantic-release | ||
- name: Slack Notification on Failure | ||
if: ${{ failure() }} | ||
uses: rtCamp/[email protected] | ||
env: | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_PRIVATE_TEAM_WEBHOOK }} | ||
SLACK_USERNAME: "spectromate" | ||
SLACK_ICON_EMOJI: ":robot_panic:" | ||
SLACK_COLOR: "danger" | ||
SLACKIFY_MARKDOWN: true | ||
ENABLE_ESCAPES: true | ||
SLACK_MESSAGE: "The release job for `${{ github.workflow }}` in `${{ github.repository }}` failed at step: `${{ env.CURRENT_STEP }}`. [View details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." |