mirror of
https://github.com/spring-projects/spring-security.git
synced 2025-07-07 11:12:14 +00:00
invalidate CDN cache after full build
This commit is contained in:
parent
7757eab714
commit
c9ee194832
11
.github/actions/publish-docs.sh
vendored
11
.github/actions/publish-docs.sh
vendored
@ -5,10 +5,12 @@ HOST="$1"
|
|||||||
HOST_PATH="$2"
|
HOST_PATH="$2"
|
||||||
SSH_PRIVATE_KEY="$3"
|
SSH_PRIVATE_KEY="$3"
|
||||||
SSH_KNOWN_HOST="$4"
|
SSH_KNOWN_HOST="$4"
|
||||||
|
CLOUDFLARE_ZONE_ID="$5"
|
||||||
|
CLOUDFLARE_CACHE_TOKEN="$6"
|
||||||
SSH_PRIVATE_KEY_PATH="$HOME/.ssh/${GITHUB_REPOSITORY:-publish-docs}"
|
SSH_PRIVATE_KEY_PATH="$HOME/.ssh/${GITHUB_REPOSITORY:-publish-docs}"
|
||||||
|
|
||||||
if [ "$#" -ne 4 ]; then
|
if [ "$#" -ne 6 ]; then
|
||||||
echo -e "not enough arguments USAGE:\n\n$0 \$HOST \$HOST_PATH \$SSH_PRIVATE_KEY \$SSH_KNOWN_HOST\n\n" >&2
|
echo -e "not enough arguments USAGE:\n\n$0 \$HOST \$HOST_PATH \$SSH_PRIVATE_KEY \$SSH_KNOWN_HOST \$CLOUDFLARE_ZONE_ID \$CLOUDFLARE_CACHE_TOKEN\n\n" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -28,6 +30,11 @@ fi
|
|||||||
RSYNC_OPTS="$RSYNC_OPTS$(find $FROM -mindepth 1 -maxdepth 1 -type d \! -name _ -printf ' --include /%P --include /%P/**') --exclude **"
|
RSYNC_OPTS="$RSYNC_OPTS$(find $FROM -mindepth 1 -maxdepth 1 -type d \! -name _ -printf ' --include /%P --include /%P/**') --exclude **"
|
||||||
fi
|
fi
|
||||||
rsync $RSYNC_OPTS -e "ssh -i $SSH_PRIVATE_KEY_PATH" $FROM/ "$HOST:$HOST_PATH"
|
rsync $RSYNC_OPTS -e "ssh -i $SSH_PRIVATE_KEY_PATH" $FROM/ "$HOST:$HOST_PATH"
|
||||||
|
if [ -z "$BUILD_REFNAME" ]; then
|
||||||
|
curl -X POST "https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/purge_cache" \
|
||||||
|
-H "Content-Type:application/json" -H "Authorization: Bearer $CLOUDFLARE_CACHE_TOKEN" \
|
||||||
|
--data '{"files":["https://docs.spring.io/spring-security"]}'
|
||||||
|
fi
|
||||||
)
|
)
|
||||||
exit_code=$?
|
exit_code=$?
|
||||||
|
|
||||||
|
2
.github/workflows/deploy-docs.yml
vendored
2
.github/workflows/deploy-docs.yml
vendored
@ -37,4 +37,4 @@ jobs:
|
|||||||
- name: Run Antora
|
- name: Run Antora
|
||||||
run: ./gradlew antora
|
run: ./gradlew antora
|
||||||
- name: Publish Docs
|
- name: Publish Docs
|
||||||
run: ${GITHUB_WORKSPACE}/.github/actions/publish-docs.sh "${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }}" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ "${{ secrets.DOCS_SSH_KEY }}" "${{ secrets.DOCS_SSH_HOST_KEY }}"
|
run: $GITHUB_WORKSPACE/.github/actions/publish-docs.sh "${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }}" /opt/www/domains/spring.io/docs/htdocs/spring-security/reference/ "${{ secrets.DOCS_SSH_KEY }}" "${{ secrets.DOCS_SSH_HOST_KEY }}" "${{ secrets.CLOUDFLARE_ZONE_ID }}" "${{ secrets.CLOUDFLARE_CACHE_TOKEN }}"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user