update docs config #70
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | |
on: | |
push: | |
paths: | |
- 'examples/cloudflare-webhook/**' | |
- 'docs/**' | |
- 'apps/worker-docs/**' | |
- '.github/workflows/deploy.yml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
examples: | |
name: Deploy examples | |
runs-on: ubuntu-latest | |
if: github.ref_name == 'main' && github.ref_type == 'branch' | |
strategy: | |
matrix: | |
node-version: | |
- 20.x | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install node.js v${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: npm | |
- name: Install dependencies | |
run: npm install | |
- name: Run tsc | |
run: npm run prestart | |
- name: Run build | |
run: npm run build | |
- name: Install example dependencies | |
run: npm install | |
working-directory: ./examples/cloudflare-webhook/ | |
- name: Deploy cloudflare-webhook | |
uses: cloudflare/wrangler-action@v3.6.0 | |
env: | |
DISCORD_WEBHOOK_URL: ${{ secrets.CW_DISCORD_WEBHOOK_URL }} | |
HTML_MD_KEY: ${{ secrets.CW_HTML_MD_KEY }} | |
PATREON_WEBHOOK_SECRET: ${{ secrets.CW_PATREON_WEBHOOK_SECRET }} | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
workingDirectory: ./examples/cloudflare-webhook/ | |
secrets: | | |
HTML_MD_KEY | |
PATREON_WEBHOOK_SECRET | |
DISCORD_WEBHOOK_URL | |
docs: | |
name: Deploy documentation | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
deployments: write | |
strategy: | |
matrix: | |
node-version: | |
- 20.x | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install node.js v${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: npm | |
- name: Install dependencies | |
run: npm install | |
- name: Run tsc | |
run: npm run prestart | |
- name: Run build | |
run: npm run build | |
- name: Install dependencies | |
run: npm install | |
working-directory: docs | |
- name: Build documentation | |
run: npm run docs:build | |
working-directory: docs | |
- name: Install wrangler | |
run: npm i -D wrangler --legacy-peer-deps | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/wrangler-action@v3.6.0 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: pages deploy docs/.vitepress/dist --project-name=patreon-api --commit-dirty=true | |
- name: Install worker dependencies | |
run: npm install | |
working-directory: ./apps/worker-docs | |
- name: Deploy patreon-docs worker | |
uses: cloudflare/wrangler-action@v3.6.0 | |
with: | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
command: deploy -c ./apps/worker-docs/wrangler.toml |