-
Notifications
You must be signed in to change notification settings - Fork 4
41 lines (37 loc) · 1.22 KB
/
cloudflare-pages-deploy.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
name: Deploy Remote Configs
on:
push:
branches:
- main
- dev
workflow_dispatch:
inputs:
environment:
description: 'Deployment Environment'
required: true
default: 'Production'
type: choice
options:
- Production
- Development
jobs:
deploy:
runs-on: ubuntu-latest
name: Deploy
environment: ${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'Production' || 'Development') }}
steps:
- name: Checkout configs folder
uses: actions/checkout@v4
with:
sparse-checkout: |
configs
sparse-checkout-cone-mode: false
- name: Create version.json
run: |
echo "{\"commit\": \"${{ github.sha }}\", \"environment\": \"${{ github.event.inputs.environment || (github.ref == 'refs/heads/main' && 'Production' || 'Development') }}\"}" > configs/version.json
- name: Deploy to Cloudflare Pages
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
command: pages deploy configs --project-name=${{ vars.CLOUDFLARE_PROJECT_NAME }}