Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Commit

Permalink
feat: ✨ deploy to fly
Browse files Browse the repository at this point in the history
  • Loading branch information
AruSeito committed May 13, 2024
1 parent 448da04 commit f9d724e
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/deploy-fly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Deploy to k8s

on:
push:
branches:
- release/2.0

env:
ILLA_MIXPANEL_API_KEY: ${{ secrets.ILLA_MIXPANEL_API_KEY }}
ILLA_AMPLITUDE_API_KEY: ${{ secrets.ILLA_AMPLITUDE_API_KEY }}
ILLA_MUI_LICENSE: ${{ secrets.ILLA_MUI_LICENSE }}
ILLA_SENTRY_AUTH_TOKEN: ${{ secrets.ILLA_SENTRY_AUTH_TOKEN }}
DO_CLUSTER: ${{ secrets.DO_CLUSTER }}
DOCKER_LOGIN: ${{ secrets.DOCKER_LOGIN }}
DOCKER_PWD: ${{ secrets.DOCKER_PWD }}
DO_TOKEN: ${{ secrets.DO_TOKEN }}
ILLA_INTERCOM_APP_ID: ${{ secrets.ILLA_INTERCOM_APP_ID }}
ILLA_POSTHOG_KEY: ${{ secrets.ILLA_POSTHOG_KEY }}
jobs:
build:
name: Build website
runs-on: ubuntu-latest
environment:
name: "test"
env:
ILLA_API_BASE_URL: ${{ vars.ILLA_API_BASE_URL }}
ILLA_APP_ENV: ${{ vars.ILLA_APP_ENV }}
ILLA_CLOUD_URL: ${{ vars.ILLA_CLOUD_URL }}
ILLA_MARKET_URL: ${{ vars.ILLA_MARKET_URL }}
ILLA_PERIPHERAL_API_BASE_URL: ${{ vars.ILLA_PERIPHERAL_API_BASE_URL }}

steps:
- uses: actions/checkout@v4
with:
submodules: true

- uses: actions/setup-node@v4
with:
node-version: 20.12.2

- uses: pnpm/action-setup@v3
with:
version: 9.0.6

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build website
run: |
echo "Building for $GITHUB_REF_NAME branch,ILLA APP ENV is $ILLA_APP_ENV"
pnpm build
- name: Compress tipis
run: |
tar -czvf tipis-fe.tar.gz ./apps/agent/dist ./nginx.conf ./Dockerfile ./tipisai-frontend.conf
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: tipis-fe.tar.gz

deploy:
needs: build
name: Deploy to fly
runs-on: ubuntu-latest
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts

- name: Load build artifacts
run: |
tar -xzvf tipis-fe.tar.gz
- uses: superfly/flyctl-actions/setup-flyctl@master
- run: flyctl deploy --remote-only
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
22 changes: 22 additions & 0 deletions fly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# fly.toml app configuration file generated for tipis on 2024-05-13T15:13:48+08:00
#
# See https://fly.io/docs/reference/configuration/ for information about how to use this file.
#

app = 'tipis'
primary_region = 'lax'

[build]

[http_service]
internal_port = 80
force_https = true
auto_stop_machines = true
auto_start_machines = true
min_machines_running = 0
processes = ['app']

[[vm]]
memory = '1gb'
cpu_kind = 'shared'
cpus = 1

0 comments on commit f9d724e

Please sign in to comment.