-
Notifications
You must be signed in to change notification settings - Fork 60.3k
76 lines (66 loc) · 2.37 KB
/
purge-fastly.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Purge Fastly
# **What it does**: Sends a soft-purge to Fastly.
# **Why we have it**: So that, right after a production deploy, we start afresh
# **Who does it impact**: Writers and engineers.
on:
workflow_dispatch:
inputs:
nuke_all:
description: "Nuke all 'every-deployment' keys independent of language"
required: false
type: boolean
default: false
languages:
description: "Comma separated languages. E.g. 'en,ja, es' (defaults to all)"
required: false
default: ''
push:
branches:
- main
permissions:
contents: read
env:
FASTLY_TOKEN: ${{ secrets.FASTLY_TOKEN }}
FASTLY_SERVICE_ID: ${{ secrets.FASTLY_SERVICE_ID }}
jobs:
send-purges:
if: >-
${{
github.repository == 'github/docs-internal' &&
(github.event_name != 'workflow_run' ||
github.event.workflow_run.conclusion == 'success')
}}
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./.github/actions/node-npm-setup
- name: Wait for production to match build number
run: |
needs=$(git rev-parse HEAD)
start_time=$(date +%s)
timeout_seconds=1200
while [[ $needs != $(curl -s --fail --retry-connrefused --retry 5 https://docs.github.com/_build) ]]
do
if [[ $(($(date +%s) - $start_time)) -gt $timeout_seconds ]]
then
echo "Production did not match the build number within $timeout_seconds seconds"
exit 1
fi
echo "Production is not up to date with the build commit"
sleep 10
done
echo "Production is up to date with the build commit"
- name: Purge Fastly edge cache independent of language
if: ${{ inputs.nuke_all }}
run: npm run purge-fastly-edge-cache
- name: Purge Fastly edge cache per language
if: ${{ !inputs.nuke_all }}
env:
LANGUAGES: ${{ inputs.languages }}
run: npm run purge-fastly-edge-cache-per-language
- uses: ./.github/actions/slack-alert
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
with:
slack_channel_id: ${{ secrets.DOCS_ALERTS_SLACK_CHANNEL_ID }}
slack_token: ${{ secrets.SLACK_DOCS_BOT_TOKEN }}