rubysg/rubysg-reboot

View on GitHub
.github/workflows/deploy_to_fly.yml

Summary

Maintainability
Test Coverage
name: Deploy To Fly
on:
  push:
    branches:
      - 'master'
env:
  FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
jobs:
  test:
    runs-on: ubuntu-latest
    services:
      postgres:
        image: postgres:latest
        env:
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
        ports: ['5432:5432']
        options:
          --health-cmd pg_isready
          --health-interval 10s
          --health-timeout 5s
          --health-retries 5
    steps:
      - uses: actions/checkout@v3
      - name: Set up Ruby
        uses: ruby/setup-ruby@v1
        with:
          ruby-version: 3.3.1
      - name: Setup environment and run tests
        env:
          DATABASE_URL: postgres://postgres:postgres@localhost:5432/test
          RAILS_ENV: test
          POSTGRES_USER: postgres
          POSTGRES_PASSWORD: postgres
          RUBY_SG_BOT_ID: 6124430288
          RUBY_SG_BOT_TOKEN: access-token
        run: |
          bundle install
          bundle exec rails db:create db:migrate
          bundle exec rspec spec
      - name: Setup flyctl
        uses: superfly/flyctl-actions/setup-flyctl@master
      - name: Deploy to fly.io
        run: make deploy