Skip to content

Test & Deploy Dart Frog Backend #25

Test & Deploy Dart Frog Backend

Test & Deploy Dart Frog Backend #25

name: Test & Deploy Dart Frog Backend
on:
push:
branches:
- main
paths:
- '.github/workflows/publish_backend.yaml'
- 'backend/**'
- 'core/**'
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Dart
uses: dart-lang/setup-dart@v1
- name: Install Dependencies
working-directory: ./backend
run: dart pub get
- name: Get dependencies (core)
working-directory: ./core
run: dart pub get
- name: Run build_runner (core)
working-directory: ./core
run: dart run build_runner build --delete-conflicting-outputs
- name: Run Tests
working-directory: ./backend
run: dart test
- name: Install Globe CLI
run: dart pub global activate globe_cli
- name: Deploy to Globe
run: |
if [[ ${{ github.ref }} == 'refs/heads/main' ]]; then
globe deploy --token=${{ secrets.GLOBE_TOKEN }} --project="${{ secrets.GLOBE_PROJECT_ID }}" --prod
else
globe deploy --token=${{ secrets.GLOBE_TOKEN }} --project="${{ secrets.GLOBE_PROJECT_ID }}"
fi