diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..bf402af --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,41 @@ +name: Deploy +on: + push: + branches: + - main + - dev + pull_request: + types: closed + branches: + - dev + +jobs: + Deploy: + if: (github.ref_name == 'dev' && github.event.pull_request.merged == true) || github.ref_name == 'main' + runs-on: ubuntu-latest + env: + MODAL_TOKEN_ID: ${{ secrets.MODAL_TOKEN_ID }} + MODAL_TOKEN_SECRET: ${{ secrets.MODAL_TOKEN_SECRET }} + MODAL_ENVIRONMENT: |- + ${{ case( + github.ref_name == 'main', 'prod', + github.ref_name == 'dev', 'dev', + 'dev' + ) }} + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install Modal + run: | + python -m pip install --upgrade pip + pip install modal + + - name: Deploy to Modal + run: | + modal deploy modal_app.py