-
-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (90 loc) · 3.62 KB
/
Copy pathbuild-and-deploy.yaml
File metadata and controls
103 lines (90 loc) · 3.62 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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Build and Deploy to Neocities and Bunny CDN
on:
push:
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
build-and-deploy:
name: Build and Deploy
# runs-on: ubuntu-latest # YOU PROBABLY WANT THIS!
runs-on: ubicloud-standard-16
env:
NEOCITIES_API_KEY: ${{ secrets.NEOCITIES_API_KEY }}
BUNNY_ACCESS_KEY: ${{ secrets.BUNNY_ACCESS_KEY }}
INDEXNOW_KEY: ${{ secrets.INDEXNOW_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Restore image cache
uses: actions/cache@v4
with:
path: .image-cache
key: images-${{ hashFiles('src/images/**/*') }}
restore-keys: |
images-
- name: Update config.json with secrets
run: |
sed -i 's|"formspark_id": null|"formspark_id": "${{ secrets.FORMSPARK_ID }}"|g' src/_data/config.json
sed -i 's|"botpoison_public_key": null|"botpoison_public_key": "${{ secrets.BOTPOISON_PUBLIC_KEY }}"|g' src/_data/config.json
sed -i 's|"ecommerce_api_host": null|"ecommerce_api_host": "${{ secrets.ECOMMERCE_API_HOST }}"|g' src/_data/config.json
sed -i 's|"stripe_publishable_key": null|"stripe_publishable_key": "${{ secrets.STRIPE_PUBLISHABLE_KEY }}"|g' src/_data/config.json
sed -i 's|"cart_mode": null|"cart_mode": "${{ secrets.CART_MODE }}"|g' src/_data/config.json
sed -i 's|"ntfy_channel": null|"ntfy_channel": "${{ secrets.NTFY_FRONTEND_TOPIC }}"|g' src/_data/config.json
- name: Build Site
run: |
bun install --frozen-lockfile
bun run build
- name: Write IndexNow key file
if: github.ref == 'refs/heads/main' && env.INDEXNOW_KEY != ''
run: echo "${{ secrets.INDEXNOW_KEY }}" > "_site/${{ secrets.INDEXNOW_KEY }}.txt"
- name: Deploy to Neocities
if: github.ref == 'refs/heads/main' && env.NEOCITIES_API_KEY != ''
uses: bcomnes/deploy-to-neocities@v3
with:
api_key: ${{ secrets.NEOCITIES_API_KEY }}
cleanup: true
neocities_supporter: true
preview_before_deploy: false
dist_dir: _site
- name: Deploy to Bunny CDN
if: github.ref == 'refs/heads/main' && env.BUNNY_ACCESS_KEY != ''
uses: R-J-dev/bunny-deploy@v2.0.6
with:
access-key: ${{ secrets.BUNNY_ACCESS_KEY }}
directory-to-upload: _site
storage-endpoint: "https://storage.bunnycdn.com"
storage-zone-name: "chobble-example"
storage-zone-password: ${{ secrets.BUNNY_STORAGE_ZONE_PASSWORD }}
concurrency: "5"
enable-delete-action: true
enable-purge-pull-zone: true
pull-zone-id: 4582983
replication-timeout: "15000"
- name: Get site URL
id: site-url
run: echo "url=$(jq -r '.url' src/_data/site.json)" >> $GITHUB_OUTPUT
- name: Submit to IndexNow
if: github.ref == 'refs/heads/main' && env.INDEXNOW_KEY != ''
uses: bojieyang/indexnow-action@v3
with:
sitemap-location: "${{ steps.site-url.outputs.url }}/sitemap.xml"
key: ${{ secrets.INDEXNOW_KEY }}
notify-failure:
name: Notify on Failure
runs-on: ubuntu-latest
needs: [build-and-deploy]
if: failure() && github.ref_name == 'main'
steps:
- name: Send failure notification
uses: NiNiyas/ntfy-action@master
with:
url: 'https://ntfy.sh'
topic: ${{ secrets.NTFY_TOPIC }}