Skip to content

Commit 445f83f

Browse files
committed
docs: add current step failure logic
1 parent f29f57f commit 445f83f

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

.github/workflows/release.yaml

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,35 +44,48 @@ jobs:
4444
name: Build Website (Self-Hosted Runner)
4545
runs-on: ["self-hosted", "linux", "x64", "vcenter3"]
4646
steps:
47+
48+
- name: Force Failure
49+
run: |
50+
echo "CURRENT_STEP=Force Failure" >> $GITHUB_ENV
51+
exit 1
52+
4753
- name: Checkout Repository
54+
run: echo "CURRENT_STEP=Checkout Repository" >> $GITHUB_ENV
4855
uses: actions/checkout@v4
4956
with:
5057
fetch-depth: 0
5158
ref: "master"
5259

5360

5461
- name: Setup Node.js environment
62+
run: echo "CURRENT_STEP=Setup Node.js environment" >> $GITHUB_ENV
5563
uses: actions/setup-node@v4
5664
with:
5765
node-version: "20"
5866
cache: "npm"
5967

60-
- run: npm ci
61-
68+
- run: |
69+
echo "CURRENT_STEP=npm ci" >> $GITHUB_ENV
70+
npm ci
71+
6272
- name: Build
6373
run: |
74+
echo "CURRENT_STEP=Build" >> $GITHUB_ENV
6475
touch .env
6576
make versions-ci
6677
make build-ci
6778
6879
- name: Build with cached packs
6980
if: ${{ env.BUILD_EXIT_CODE == '5' }}
81+
run: echo "CURRENT_STEP=Build with cached packs" >> $GITHUB_ENV
7082
uses: ./.github/actions/build-cached-packs
7183
with:
7284
gh-token: ${{ secrets.GITHUB_TOKEN }}
7385

7486
- name: Upload to AWS
7587
run: |
88+
echo "CURRENT_STEP=Upload to AWS" >> $GITHUB_ENV
7689
aws s3 sync --cache-control 'public, max-age=604800' --exclude '*.html' --exclude '*.xml' --exclude build/scripts/ build/ s3://docs.spectrocloud.com --delete
7790
aws s3 sync --cache-control 'public, max-age=0, s-maxage=604800' build/ s3://docs.spectrocloud.com --delete
7891
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*"
@@ -87,7 +100,7 @@ jobs:
87100
SLACK_COLOR: "danger"
88101
SLACKIFY_MARKDOWN: true
89102
ENABLE_ESCAPES: true
90-
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 }})."
103+
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 }})."
91104

92105

93106
# 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:
99112
labels: docbot
100113
steps:
101114
- name: Checkout Repository
115+
run: echo "CURRENT_STEP=Checkout Repository" >> $GITHUB_ENV
102116
uses: actions/checkout@v4
103117
with:
104118
fetch-depth: 0
105119
ref: "master"
106120

107121

108122
- name: Setup Node.js environment
123+
run: echo "CURRENT_STEP=Setup Node.js environment" >> $GITHUB_ENV
109124
uses: actions/setup-node@v4
110125
with:
111126
node-version: "20"
112127
cache: "npm"
113128

114-
- run: npm ci
129+
- run: |
130+
echo "CURRENT_STEP=npm ci" >> $GITHUB_ENV
131+
npm ci
115132
116133
- name: Versions
117134
run: |
135+
echo "CURRENT_STEP=Versions" >> $GITHUB_ENV
118136

119137
- name: Build
120138
run: |
139+
echo "CURRENT_STEP=Build" >> $GITHUB_ENV
121140
touch .env
122141
make versions-ci
123142
make build-ci
124143
125144
- name: Build with cached packs
145+
run: echo "CURRENT_STEP=Build with cached packs" >> $GITHUB_ENV
126146
if: ${{ env.BUILD_EXIT_CODE == '5' }}
127147
uses: ./.github/actions/build-cached-packs
128148
with:
129149
gh-token: ${{ secrets.GITHUB_TOKEN }}
130150

131151
- name: Upload to AWS
132152
run: |
153+
echo "CURRENT_STEP=Upload to AWS" >> $GITHUB_ENV
133154
aws s3 sync --cache-control 'public, max-age=604800' --exclude '*.html' --exclude '*.xml' --exclude build/scripts/ build/ s3://docs.spectrocloud.com --delete
134155
aws s3 sync --cache-control 'public, max-age=0, s-maxage=604800' build/ s3://docs.spectrocloud.com --delete
135156
aws cloudfront create-invalidation --distribution-id ${{ secrets.DISTRIBUTION_ID }} --paths "/*"
@@ -144,7 +165,7 @@ jobs:
144165
SLACK_COLOR: "danger"
145166
SLACKIFY_MARKDOWN: true
146167
ENABLE_ESCAPES: true
147-
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 }})."
168+
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 }})."
148169

149170
release:
150171
name: "Release"
@@ -154,12 +175,14 @@ jobs:
154175
steps:
155176
- id: checkout
156177
name: Checkout Repository
178+
run: echo "CURRENT_STEP=Checkout Repository" >> $GITHUB_ENV
157179
uses: actions/checkout@v4
158180
with:
159181
fetch-depth: 0
160182
token: ${{ secrets.GITHUB_TOKEN }}
161183

162184
- name: Retrieve Credentials
185+
run: echo "CURRENT_STEP=Retrieve Credentials" >> $GITHUB_ENV
163186
id: import-secrets
164187
uses: hashicorp/[email protected]
165188
with:
@@ -170,18 +193,23 @@ jobs:
170193
secrets: /providers/github/organizations/spectrocloud/token?org_name=spectrocloud token | VAULT_GITHUB_TOKEN
171194

172195
- name: Setup Nodejs
196+
run: echo "CURRENT_STEP=Setup Nodejs" >> $GITHUB_ENV
173197
uses: actions/setup-node@v4
174198
with:
175199
node-version: "20"
176200
cache: "npm"
177201

178202
- name: Install dependencies
179-
run: npm ci
203+
run: |
204+
echo "CURRENT_STEP=Install dependencies" >> $GITHUB_ENV
205+
npm ci
180206
181207
- name: "release"
182208
env:
183209
GITHUB_TOKEN: ${{ steps.import-secrets.outputs.VAULT_GITHUB_TOKEN }}
184-
run: npx semantic-release
210+
run: |
211+
echo "CURRENT_STEP=release" >> $GITHUB_ENV
212+
npx semantic-release
185213
186214
- name: Slack Notification on Failure
187215
if: ${{ failure() }}
@@ -193,4 +221,4 @@ jobs:
193221
SLACK_COLOR: "danger"
194222
SLACKIFY_MARKDOWN: true
195223
ENABLE_ESCAPES: true
196-
SLACK_MESSAGE: "The release job for `${{ github.workflow }}` in `${{ github.repository }}` failed. [View details](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})."
224+
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 }})."

0 commit comments

Comments
 (0)