Skip to content

Commit

Permalink
Add deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
omfj committed Sep 24, 2024
1 parent 3d47589 commit eb1b916
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 6 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 🚀 Deploy

on:
push:
branches:
- main

jobs:
api:
runs-on: ubuntu-latest

steps:
- name: 🔍 Checkout
uses: actions/checkout@v4

- name: 📦 Install dependencies
uses: ./.github/actions/pnpm-install

- name: 🪰 Setup Fly
uses: superfly/flyctl-actions/setup-flyctl@master

- name: 🚀 Deploy
run: flyctl deploy --config apps/api/fly.toml --dockerfile apps/api/Dockerfile --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
4 changes: 3 additions & 1 deletion apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import app from "./app";

const PORT = process.env.API_PORT ? Number(process.env.API_PORT) : 8000;

const isCI = !!process.env.CI;

serve(
{
fetch: app.fetch,
port: PORT,
hostname: "127.0.0.1",
hostname: isCI ? "localhost" : "0.0.0.0",
},
(info) => {
console.log(`Listening on http://localhost:${info.port}`);
Expand Down
10 changes: 5 additions & 5 deletions playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,23 @@ export default defineConfig({

webServer: [
{
command: "pnpm run dev",
command: "pnpm run start",
cwd: "../apps/web",
url: "http://127.0.0.1:3000",
url: "http://localhost:3000",
reuseExistingServer: !isCI,
},
{
command: "pnpm run dev",
command: "pnpm run start",
cwd: "../apps/api",
url: "http://127.0.0.1:8000",
url: "http://localhost:8000",
reuseExistingServer: !isCI,
stdout: "pipe",
},
],

use: {
headless: isCI,
baseURL: "http://127.0.0.1:3000",
baseURL: "http://localhost:3000",
video: "retain-on-failure",
trace: "retain-on-failure",
timezoneId: "Europe/Oslo",
Expand Down

0 comments on commit eb1b916

Please sign in to comment.