Skip to content

Commit 84d03ca

Browse files
authored
Merge pull request ubiquity#37 from rndquu/ci/add-cf-deploy
ci: add reusable cloudflare deploy
2 parents c8ca164 + 90671ef commit 84d03ca

File tree

3 files changed

+33
-35
lines changed

3 files changed

+33
-35
lines changed

.github/workflows/build.yml

+8-20
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
name: Build & Deploy
1+
name: Build
22

33
on:
4-
workflow_run:
5-
workflows: ["Init"]
6-
types:
7-
- completed
4+
push:
5+
pull_request:
6+
workflow_dispatch:
87

98
permissions:
109
contents: read
@@ -16,8 +15,6 @@ jobs:
1615
steps:
1716
- name: Check out repository
1817
uses: actions/checkout@v4
19-
# with:
20-
# submodules: "recursive" # Ensures submodules are checked out
2118

2219
- name: Set up Node.js
2320
uses: actions/setup-node@v4
@@ -28,18 +25,9 @@ jobs:
2825
run: |
2926
yarn
3027
yarn build
31-
# env: # Set environment variables for the build
32-
# SUPABASE_URL: "https://wfzpewmlyiozupulbuur.supabase.co"
33-
# SUPABASE_ANON_KEY: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6IndmenBld21seWlvenVwdWxidXVyIiwicm9sZSI6ImFub24iLCJpYXQiOjE2OTU2NzQzMzksImV4cCI6MjAxMTI1MDMzOX0.SKIL3Q0NOBaMehH0ekFspwgcu3afp3Dl9EDzPqs1nKs"
3428
35-
- name: Deploy to Cloudflare
36-
uses: ubiquity/cloudflare-deploy-action@main
29+
- name: Upload build artifact
30+
uses: actions/upload-artifact@v4
3731
with:
38-
repository: ${{ github.repository }}
39-
production_branch: ${{ github.event.repository.default_branch }}
40-
output_directory: "static"
41-
current_branch: ${{ github.ref_name }}
42-
pull_request_number: ${{ github.event.pull_request.number }}
43-
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
44-
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
45-
commit_sha: ${{ github.event.pull_request.head.sha }}
32+
name: static
33+
path: static

.github/workflows/deploy.yml

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Deploy to Cloudflare Pages
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
deploy-to-cloudflare:
11+
name: Automatic Cloudflare Deploy
12+
runs-on: ubuntu-22.04
13+
steps:
14+
- name: Deploy to Cloudflare
15+
if: ${{ github.event.workflow_run.conclusion == 'success' }}
16+
uses: ubiquity/cloudflare-deploy-action@main
17+
with:
18+
repository: ${{ github.repository }}
19+
production_branch: ${{ github.event.repository.default_branch }}
20+
output_directory: "static"
21+
current_branch: ${{ github.event.workflow_run.head_branch }}
22+
cloudflare_account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
23+
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
24+
commit_sha: ${{ github.event.workflow_run.head_sha }}
25+
workflow_run_id: ${{ github.event.workflow_run.id }}

.github/workflows/init.yml

-15
This file was deleted.

0 commit comments

Comments
 (0)