Skip to content

Commit 50ba901

Browse files
committed
add cloudflare sites deploy
1 parent 6eb7fa2 commit 50ba901

2 files changed

Lines changed: 37 additions & 15 deletions

File tree

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: "Upload to Cloudflare Sites"
2+
description: "Uploads files to Cloudflare Pages"
3+
4+
inputs:
5+
api_token:
6+
description: "Cloudflare API token for authentication."
7+
required: true
8+
account_id:
9+
description: "Cloudflare account ID."
10+
required: true
11+
project_name:
12+
description: "Name of the Cloudflare Pages project."
13+
required: true
14+
source_path:
15+
description: "Local path to the dist folder to upload."
16+
required: true
17+
default: "dist"
18+
19+
runs:
20+
using: "composite"
21+
steps:
22+
- name: Deploy to Cloudflare Pages
23+
uses: cloudflare/wrangler-action@v3
24+
with:
25+
apiToken: ${{ inputs.api_token }}
26+
accountId: ${{ inputs.account_id }}
27+
command: pages deploy ${{ inputs.source_path }} --project-name=${{ inputs.project_name }} --production

.github/workflows/deploy-static-app.yml

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,22 @@ on:
1313
default: "dist/"
1414
type: string
1515
required: false
16-
bucket_name:
16+
project_name:
1717
required: true
1818
type: string
19-
description: "Name of the S3 bucket where files will be uploaded."
20-
endpoint:
21-
required: false
22-
type: string
23-
description: "Custom endpoint for S3-compatible storage. Use this if you are not using AWS S3, but a compatible service."
19+
description: "Name of the Cloudflare Pages project."
2420
ref:
2521
required: false
2622
type: string
2723
description: "The branch or tag to deploy. Defaults to the current branch."
2824
default: ${{ github.ref }}
2925
secrets:
30-
ACCESS_KEY:
26+
CLOUDFLARE_API_TOKEN:
3127
required: true
32-
description: "AWS access key for authentication."
33-
SECRET_KEY:
28+
description: "Cloudflare API token for authentication."
29+
CLOUDFLARE_ACCOUNT_ID:
3430
required: true
35-
description: "AWS secret key for authentication."
31+
description: "Cloudflare account ID."
3632

3733
jobs:
3834
setup:
@@ -98,10 +94,9 @@ jobs:
9894
with:
9995
build_path: ${{ inputs.build_path }}
10096
- name: Deploy
101-
uses: Beuterei/reusable-workflows/.github/actions/upload-to-s3@main
97+
uses: Beuterei/reusable-workflows/.github/actions/upload-to-cloudflare-sites@main
10298
with:
103-
access_key: ${{ secrets.ACCESS_KEY }}
104-
secret_key: ${{ secrets.SECRET_KEY }}
105-
bucket_name: ${{ inputs.bucket_name }}
106-
endpoint: ${{ inputs.endpoint }}
99+
api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
100+
account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
101+
project_name: ${{ inputs.project_name }}
107102
source_path: ${{ inputs.build_path }}

0 commit comments

Comments
 (0)