-
Notifications
You must be signed in to change notification settings - Fork 0
179 lines (160 loc) · 6.8 KB
/
ci.yaml
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
audit-build-test-deploy:
name: 🔧 Audit, build, test, deploy
runs-on: ubuntu-latest
steps:
- name: 🛎️ Checkout repo
uses: actions/checkout@v4
- name: 🖥️ Setup Node.js
# https://github.com/marketplace/actions/setup-node-js-environment
uses: actions/setup-node@v4
with:
# https://github.com/nodejs/Release/blob/main/CODENAMES.md
node-version: lts/Iron
- run: npm ci --include dev --include prod
- name: 🛡️ Audit security
continue-on-error: true
run: npm audit --audit-level=moderate
- name: 🔧 Build website
env:
CLOUDINARY: ${{ secrets.CLOUDINARY }}
DEBUG: Eleventy:ErrorHandler,eleventy-plugin-text-to-speech/*,-eleventy-plugin-text-to-speech/transforms
DOMAIN: ${{ secrets.DOMAIN }}
GCP_CREDENTIALS_JSON: ${{ secrets.GCP_CREDENTIALS_JSON }}
NODE_ENV: production
STRIPE_LIVE: ${{ secrets.STRIPE_LIVE }}
TELEGRAM: ${{ secrets.TELEGRAM }}
WEBMENTION_IO_TOKEN: ${{ secrets.WEBMENTION_IO_TOKEN }}
WEBPAGETEST: ${{ secrets.WEBPAGETEST }}
run: npm run build
- name: 🔍 Test website
env:
STRIPE_TEST: ${{ secrets.STRIPE_TEST }}
run: npm run test
- name: 🌐 Deploy to Cloudflare Pages
# https://developers.cloudflare.com/pages/how-to/use-direct-upload-with-continuous-integration/
# https://github.com/marketplace/actions/cloudflare-pages-github-action
uses: cloudflare/pages-action@1
with:
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
projectName: personal-website
directory: _site
# Optional: Enable this if you want to have GitHub Deployments triggered
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# wpt:
# name: Audit website with WebPageTest API
# needs: [audit-build-test-deploy]
# if: ${{ github.event_name == 'pull_request' }}
# runs-on: ubuntu-latest
# steps:
# - name: 🛎️ Checkout repo
# uses: actions/checkout@v4
# - name: Wait for a successfull Deploy Preview on Netlify
# # https://github.com/JakePartusch/wait-for-netlify-action
# uses: jakepartusch/wait-for-netlify-action@v1
# id: netlify
# with:
# site_name: ${{ secrets.SITE_NAME }}
# max_timeout: 60
# - name: Audit pages with WebPageTest (home/contact, mobile)
# # https://github.com/WPO-Foundation/webpagetest-github-action
# uses: WPO-Foundation/webpagetest-github-action@v1.1.2
# with:
# apiKey: ${{ secrets.WPT_API_KEY }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# label: 'home-contact-mobile'
# urls: |
# ${{ steps.netlify.outputs.url }}/
# ${{ steps.netlify.outputs.url }}/contact/
# budget: 'wpt-budget.json'
# wptOptions: 'wpt-options-mobile.json'
# - name: Audit pages with WebPageTest (home/contact, desktop)
# uses: WPO-Foundation/webpagetest-github-action@v1.1.2
# with:
# apiKey: ${{ secrets.WPT_API_KEY }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# label: 'home-contact-desktop'
# urls: |
# ${{ steps.netlify.outputs.url }}/
# ${{ steps.netlify.outputs.url }}/contact/
# budget: 'wpt-budget.json'
# wptOptions: 'wpt-options-desktop.json'
# - name: Audit page with WebPageTest (article, desktop)
# uses: WPO-Foundation/webpagetest-github-action@v1.1.2
# env:
# ARTICLE_SLUG: 12-years-of-fires-in-sardinia
# with:
# apiKey: ${{ secrets.WPT_API_KEY }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# label: 'article-desktop'
# urls: |
# ${{ steps.netlify.outputs.url }}/posts/${{ env.ARTICLE_SLUG }}
# budget: 'wpt-budget-article-desktop.json'
# wptOptions: 'wpt-options-desktop.json'
# TODO: wait for successful Deploy Preview on Cloudflare Pages
# audit:
# name: Audit website with Lighthouse CI
# needs: [build-and-test]
# if: ${{ github.event_name == 'pull_request' }}
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Wait for a successful Deploy Preview on Netlify
# uses: jakepartusch/wait-for-netlify-action@v1
# id: netlify
# with:
# site_name: ${{ secrets.SITE_NAME }}
# max_timeout: 60
# - name: 🌐 Notify Telegram chat about Netlify deployment
# uses: appleboy/telegram-action@v0.1.1
# with:
# to: ${{ fromJSON(secrets.TELEGRAM).chat_id }}
# token: ${{ fromJSON(secrets.TELEGRAM).token }}
# format: html
# disable_web_page_preview: true
# # https://core.telegram.org/bots/api#formatting-options
# message: |
# <b>🌐 New deploy preview on Netlify</b>
# The website <code>${{ secrets.SITE_NAME }}</code> is <b>live</b> at:
# <a href="${{ steps.netlify.outputs.url }}">${{ steps.netlify.outputs.url }}</a>
# Repository: <a href="https://github.com/${{ github.repository }}/">${{ github.repository }}</a>
# <a href="https://github.com/${{ github.repository }}/commit/${{github.sha}}">Changes</a> in commit <code>${{github.sha}}</code>
# - name: Audit contact page with Lighthouse CI (mobile)
# uses: treosh/lighthouse-ci-action@v7
# with:
# urls: |
# ${{ steps.netlify.outputs.url }}/contact/
# configPath: lighthouse/lighthouserc-contact-mobile.js
# temporaryPublicStorage: true
# uploadArtifacts: true
# - name: Audit contact page with Lighthouse CI (desktop)
# uses: treosh/lighthouse-ci-action@v7
# with:
# urls: |
# ${{ steps.netlify.outputs.url }}/contact/
# configPath: lighthouse/lighthouserc-contact-desktop.js
# temporaryPublicStorage: true
# uploadArtifacts: true
# - name: Audit home, blog, project page with Lighthouse CI (desktop)
# uses: treosh/lighthouse-ci-action@v7
# env:
# ARTICLE_SLUG: 12-years-of-fires-in-sardinia
# with:
# urls: |
# ${{ steps.netlify.outputs.url }}/
# ${{ steps.netlify.outputs.url }}/blog/
# ${{ steps.netlify.outputs.url }}/projects/
# ${{ steps.netlify.outputs.url }}/posts/${{ env.ARTICLE_SLUG }}
# configPath: lighthouse/lighthouserc-all-desktop.js
# temporaryPublicStorage: true
# uploadArtifacts: true