Skip to content

[Secure Web Gateway] Added updates for SWG (#30578) #10237

[Secure Web Gateway] Added updates for SWG (#30578)

[Secure Web Gateway] Added updates for SWG (#30578) #10237

name: Publish
on:
push:
branches:
- production
jobs:
publish:
if: github.repository == 'cloudflare/cloudflare-docs'
name: Production
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0
- name: Set up pnpm
uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5
with:
version: 10
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6
id: setup-node
with:
node-version: 24.x
cache: pnpm
- name: Restore node_modules (cache hit)
id: node-modules-cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: node_modules
key: node-modules-${{ runner.os }}-node-${{ steps.setup-node.outputs.node-version }}-${{ hashFiles('pnpm-lock.yaml') }}-${{ hashFiles('package.json') }}
- name: Install node_modules (cache miss)
run: pnpm install --frozen-lockfile
if: steps.node-modules-cache.outputs.cache-hit != 'true'
- name: Restore Astro assets from cache
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5
with:
path: |
node_modules/.astro/assets
key: astro-assets-${{ hashFiles('src/assets/**') }}
restore-keys: |
astro-assets-
- name: Build
run: pnpm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload artifact
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
continue-on-error: true
with:
name: site-html
path: dist
- name: Deploy to Cloudflare Workers
run: pnpm exec wrangler deploy
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
- name: Notify Google Chat on failure
if: failure()
env:
WEBHOOK_URL: ${{ secrets.CED_TEAM_ALERTS_CHANNEL_WEBHOOK }}
ACTOR: ${{ github.actor }}
REPO: ${{ github.repository }}
RUN_ID: ${{ github.run_id }}
run: |
# Use jq to safely construct JSON payload
MESSAGE="❌ *Publish Production* workflow failed.\nActor: $ACTOR\n<https://github.com/$REPO/actions/runs/$RUN_ID|View run>"
JSON_PAYLOAD=$(jq -n --arg text "$MESSAGE" '{text: $text}')
curl -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d "$JSON_PAYLOAD"