-
Notifications
You must be signed in to change notification settings - Fork 24
60 lines (55 loc) · 1.87 KB
/
build.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Build & Deploy
on:
push:
jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: read
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.10.0
- name: Build
run: |
yarn
yarn build
- name: Check Cloudflare API Token
id: check_token
run: |
if [[ -z "${{ secrets.CLOUDFLARE_API_TOKEN }}" ]]; then
echo "Cloudflare API token is not set. Skipping deployment."
echo "::set-output name=skip::true"
else
echo "::set-output name=skip::false"
fi
shell: bash
# - name: Copy files excluding .gitignore
# if: steps.check_token.outputs.skip != 'true'
# run: |
# mkdir preserved
# rsync -av --progress . preserved --exclude-from='.gitignore'
# - name: Upload preserved directory
# if: steps.check_token.outputs.skip != 'true'
# uses: actions/upload-artifact@v4
# with:
# name: build-artifacts
# path: preserved
- name: Deploy to Cloudflare
if: steps.check_token.outputs.skip != 'true'
uses: ubiquity/cloudflare-deploy-action@main
with:
cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }}
repository: ${{ github.repository }}
production_branch: ${{ github.event.repository.default_branch }}
output_directory: "dist"
current_branch: ${{ github.ref_name }}
pull_request_number: ${{ github.event.pull_request.number }}
commit_sha: ${{ github.sha }}
# env:
# Add any environment variables you need to pass along here
# SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
# SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }}