Skip to content

Commit

Permalink
chore: deploy refactored app
Browse files Browse the repository at this point in the history
  • Loading branch information
tjmaynes committed Dec 30, 2023
1 parent c7de948 commit 563ff5d
Show file tree
Hide file tree
Showing 25 changed files with 5,468 additions and 9,086 deletions.
18 changes: 10 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: '0'
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: 18
- name: 🚀 Deploy 🚀
run: make deploy
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
node-version-file: '.node-version'
- name: 🔨 Install Dependencies 🔨
run: sudo apt-get update && sudo apt-get install make
# - name: 🚀 Deploy 🚀
# run: make deploy
# env:
# OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
# CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
# CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18.16.1
3 changes: 3 additions & 0 deletions .stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": ["stylelint-prettier/recommended"]
}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 18.16.1
28 changes: 20 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ install:
dev:
npm run dev

.PHONY: build
build:
build: clean
npm run build

start: build
build_for_cloudflare_pages:
npm run pages:build

start:
npm run start

lint:
Expand All @@ -18,13 +20,23 @@ lint_fix:
npm run lint:fix

performance:
chmod +x ./script/$@.sh
./script/$@.sh "3000"
npm run lighthouse

test: performance

ensure_cloudflare_kv_exists:
chmod +x ./script/ensure-cloudflare-kv-exists.sh
./script/ensure-cloudflare-kv-exists.sh "IMAGE_ANALYZER_KV"

ensure_cloudflare_page_exists:
chmod +x ./script/ensure-cloudflare-pages-exists.sh
./script/ensure-cloudflare-pages-exists.sh "image-analyzer-app"

test: lint build
ensure_cloudflare_infra_exists: ensure_cloudflare_page_exists ensure_cloudflare_kv_exists

deploy: install test
npm run pages:deploy
deploy: install test build_for_cloudflare_pages ensure_cloudflare_infra_exists
chmod +x ./script/cloudflare-pages-deploy.sh
./script/cloudflare-pages-deploy.sh ".vercel/output/static" "image-analyzer-app"

clean:
rm -rf node_modules/ .next/
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,4 @@ make test
To deploy the application, run the following command:
```bash
make deploy
```

## TODOS

- [ ] Migrate [stockjs](https://github.com/tjmaynes/gists/tree/main/javascript/stockjs) app to web-playground
- [ ] Migrate [tic-tac-toe](https://github.com/tjmaynes/gists/tree/main/javascript/tic-tac-toe) app to web-playground
```
10 changes: 7 additions & 3 deletions lighthouserc.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
module.exports = {
ci: {
collect: {
url: 'http://localhost:3000',
startServerCommand: 'npm run start',
url: 'http://localhost:9900',
startServerReadyTimeout: 60 * 5, // 5 minutes
numberOfRuns: 1,
},
assert: {
preset: 'lighthouse:no-pwa',
assertions: {
'categories:performance': ['error', { minScore: 0.9 }],
'categories:accessibility': ['error', { minScore: 0.9 }],
'bf-cache': 'off',
'csp-xss': 'off',
'uses-long-cache-ttl': 'off',
'total-byte-weight': 'off',
},
},
},
Expand Down
Loading

0 comments on commit 563ff5d

Please sign in to comment.