-
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: add current step failure logic
- Loading branch information
1 parent
f29f57f
commit 445f83f
Showing
1 changed file
with
36 additions
and
8 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 |
---|---|---|
|
@@ -44,35 +44,48 @@ jobs: | |
name: Build Website (Self-Hosted Runner) | ||
runs-on: ["self-hosted", "linux", "x64", "vcenter3"] | ||
steps: | ||
|
||
- name: Force Failure | ||
run: | | ||
echo "CURRENT_STEP=Force Failure" >> $GITHUB_ENV | ||
exit 1 | ||
|
||
- name: Checkout Repository | ||
run: echo "CURRENT_STEP=Checkout Repository" >> $GITHUB_ENV | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: "master" | ||
|
||
|
||
- name: Setup Node.js environment | ||
run: echo "CURRENT_STEP=Setup Node.js environment" >> $GITHUB_ENV | ||
uses: actions/setup-node@v4 | ||
with: | ||
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 | ||
- name: Build with cached packs | ||
if: ${{ env.BUILD_EXIT_CODE == '5' }} | ||
run: echo "CURRENT_STEP=Build with cached packs" >> $GITHUB_ENV | ||
uses: ./.github/actions/build-cached-packs | ||
with: | ||
gh-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- 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 "/*" | ||
|
@@ -87,7 +100,7 @@ jobs: | |
SLACK_COLOR: "danger" | ||
SLACKIFY_MARKDOWN: true | ||
ENABLE_ESCAPES: true | ||
SLACK_MESSAGE: "The self-hosted runner release job for `${{ github.workflow }}` in `${{ github.repository }}` failed. [View details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." | ||
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. | ||
|
@@ -99,37 +112,45 @@ jobs: | |
labels: docbot | ||
steps: | ||
- name: Checkout Repository | ||
run: echo "CURRENT_STEP=Checkout Repository" >> $GITHUB_ENV | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
ref: "master" | ||
|
||
|
||
- name: Setup Node.js environment | ||
run: echo "CURRENT_STEP=Setup Node.js environment" >> $GITHUB_ENV | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
cache: "npm" | ||
|
||
- run: npm ci | ||
- run: | | ||
echo "CURRENT_STEP=npm ci" >> $GITHUB_ENV | ||
npm ci | ||
- name: Versions | ||
run: | | ||
echo "CURRENT_STEP=Versions" >> $GITHUB_ENV | ||
|
||
- name: Build | ||
run: | | ||
echo "CURRENT_STEP=Build" >> $GITHUB_ENV | ||
touch .env | ||
make versions-ci | ||
make build-ci | ||
- name: Build with cached packs | ||
run: echo "CURRENT_STEP=Build with cached packs" >> $GITHUB_ENV | ||
if: ${{ env.BUILD_EXIT_CODE == '5' }} | ||
uses: ./.github/actions/build-cached-packs | ||
with: | ||
gh-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- 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 "/*" | ||
|
@@ -144,7 +165,7 @@ jobs: | |
SLACK_COLOR: "danger" | ||
SLACKIFY_MARKDOWN: true | ||
ENABLE_ESCAPES: true | ||
SLACK_MESSAGE: "The large runner release job for `${{ github.workflow }}` in `${{ github.repository }}` failed. [View details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." | ||
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" | ||
|
@@ -154,12 +175,14 @@ jobs: | |
steps: | ||
- id: checkout | ||
name: Checkout Repository | ||
run: echo "CURRENT_STEP=Checkout Repository" >> $GITHUB_ENV | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Retrieve Credentials | ||
run: echo "CURRENT_STEP=Retrieve Credentials" >> $GITHUB_ENV | ||
id: import-secrets | ||
uses: hashicorp/[email protected] | ||
with: | ||
|
@@ -170,18 +193,23 @@ jobs: | |
secrets: /providers/github/organizations/spectrocloud/token?org_name=spectrocloud token | VAULT_GITHUB_TOKEN | ||
|
||
- name: Setup Nodejs | ||
run: echo "CURRENT_STEP=Setup Nodejs" >> $GITHUB_ENV | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20" | ||
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() }} | ||
|
@@ -193,4 +221,4 @@ jobs: | |
SLACK_COLOR: "danger" | ||
SLACKIFY_MARKDOWN: true | ||
ENABLE_ESCAPES: true | ||
SLACK_MESSAGE: "The release job for `${{ github.workflow }}` in `${{ github.repository }}` failed. [View details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." | ||
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 }})." |