Skip to content

Commit ec67dbb

Browse files
authored
ci: Purge documentation CDN cache (#1105)
To fix the documentation access latency on S3, @jerome-probabl has added a CDN with a 24-hour policy. This PR intends to purge the CDN cache after each documentation deployment.
1 parent 0ad4066 commit ec67dbb

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

.github/workflows/sphinx.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,36 @@ jobs:
120120
runs-on: ubuntu-latest
121121
needs: [sphinx-version, sphinx-build]
122122
steps:
123-
- uses: actions/checkout@v4
124-
- uses: actions/download-artifact@v4
123+
- name: Checkout code
124+
uses: actions/checkout@v4
125+
126+
- name: Download HTML artifacts
127+
uses: actions/download-artifact@v4
125128
with:
126129
name: sphinx-html-artifact
127130
path: html/
128-
- uses: ./.github/actions/sphinx/deploy
131+
132+
- name: Deploy HTML artifacts
133+
uses: ./.github/actions/sphinx/deploy
129134
with:
130135
CONFIGURATION: ${{ secrets.RCLONE_CONFIG_DOCS }}
131136
BUCKET: ${{ vars.DOCUMENTATION_BUCKET }}
132137
SOURCE: html/
133138
DESTINATION: ${{ needs.sphinx-version.outputs.SPHINX_VERSION }}/
134139

140+
- name: Purge CDN cache
141+
shell: bash
142+
run: |
143+
curl --fail-with-body \
144+
-X POST \
145+
-H "X-Auth-Token: ${TOKEN}" \
146+
-H "Content-Type: application/json" \
147+
-d "{\"pipeline_id\":\"${PIPELINE_ID}\",\"all\":true}" \
148+
"https://api.scaleway.com/edge-services/v1alpha1/purge-requests"
149+
env:
150+
TOKEN: ${{ secrets.SCW_SECRET_KEY }}
151+
PIPELINE_ID: ${{ vars.DOCUMENTATION_EDGE_SERVICES_PIPELINE_ID }}
152+
135153
sphinx-deploy-root-files:
136154
if: ${{ github.event_name == 'release' }}
137155
runs-on: ubuntu-latest

0 commit comments

Comments
 (0)