-
Notifications
You must be signed in to change notification settings - Fork 0
75 lines (72 loc) · 2.3 KB
/
deploy-static-app.yml
File metadata and controls
75 lines (72 loc) · 2.3 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: Build and Deploy a static app
on:
workflow_call:
inputs:
package_manager:
description: 'The package manager to use for running scripts. Options are "npm" or "bun".'
default: "npm"
type: string
required: false
build_path:
description: "The path to the build."
default: "dist/"
type: string
required: false
project_name:
required: true
type: string
description: "Name of the Cloudflare Pages project."
ref:
required: false
type: string
description: "The branch or tag to deploy. Defaults to the current branch."
default: ${{ github.ref_name }}
secrets:
CLOUDFLARE_API_TOKEN:
required: true
description: "Cloudflare API token for authentication."
CLOUDFLARE_ACCOUNT_ID:
required: true
description: "Cloudflare account ID."
jobs:
setup:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: Beuterei/reusable-workflows/.github/actions/npm-environment-setup@main
if: inputs.package_manager == 'npm'
with:
dependencies_type: development
- uses: Beuterei/reusable-workflows/.github/actions/bun-environment-setup@main
if: inputs.package_manager == 'bun'
with:
dependencies_type: development
build:
runs-on: ubuntu-latest
needs: setup
steps:
- uses: actions/checkout@v4
with:
ref: ${{ inputs.ref }}
- uses: Beuterei/reusable-workflows/.github/actions/build@main
with:
package_manager: ${{ inputs.package_manager }}
build_path: ${{ inputs.build_path }}
deploy:
runs-on: ubuntu-latest
needs:
- build
steps:
- uses: Beuterei/reusable-workflows/.github/actions/restore-build-cache@main
with:
build_path: ${{ inputs.build_path }}
- name: Deploy
uses: Beuterei/reusable-workflows/.github/actions/upload-to-cloudflare-pages@main
with:
api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
account_id: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
project_name: ${{ inputs.project_name }}
source_path: ${{ inputs.build_path }}
ref: ${{ inputs.ref }}