hooniegit / fly.io-fastapi-demo

0 stars 0 forks source link

[Git] git action 기능을 통한 fly.io 배포 #1

Open hooniegit opened 1 year ago

hooniegit commented 1 year ago

fly 토큰 발급 및 레포지토리로의 등록

# 해당 프로젝트에 대한 fly token 발급 받기
$ fly tokens create deploy -x 999999h
스크린샷 2023-08-08 오후 3 38 02

| Settings > Secrets And Variables > Actions > New repository secret

스크린샷 2023-08-08 오후 3 38 38

| Add secret

hooniegit commented 1 year ago

git action을 위한 fly.yml 파일 생성

$ vi .github/workflows/fly.yml
name: Fly Deploy
on:
  push:
    branches:
      - main
jobs:
  deploy:
    name: Deploy app
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
      - uses: superfly/flyctl-actions/setup-flyctl@master
      - run: flyctl deploy --remote-only
        env:
          FLY_API_TOKEN: ${{ secrets.<KEY 이름> }}

실행 결과

├── .github
│   └── workflows
│       └── fly.yml
├── Dockerfile
├── README.md
├── app
│   ├── __init__
│   └── main.py
├── fly.toml
└── requirements.txt