improve workflow #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- develop | |
paths: ['backend/**', '.github/workflows/stage-backend.yml'] | |
env: | |
DATABASE_URL: ${{ secrets.DB_STAGE_URL }} | |
jobs: | |
deploy-backend-stage: | |
runs-on: ubuntu-latest | |
name: Deploy to stage | |
if: github.ref == 'refs/heads/develop' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install fly CLI | |
run: | | |
curl -L https://fly.io/install.sh | sh | |
- name: Install pnpm | |
run: npm install -g pnpm | |
- name: pnpm install | |
working-directory: ./backend | |
run: pnpm install | |
- name: Deploy migrations | |
working-directory: ./backend | |
run: pnpm db:deploy-migrations | |
- name: Deploy to stage | |
run: | | |
~/.fly/bin/fly deploy \ | |
--config fly.backend.toml \ | |
--dockerfile ./backend/Dockerfile \ | |
--app culero-stage-api \ | |
--access-token ${{ secrets.FLY_ACCESS_TOKEN }} |