mumuki/mumuki-domain

View on GitHub
.github/workflows/test_and_deploy.yml

Summary

Maintainability
Test Coverage
name: Test and deploy

on:
- push
- workflow_dispatch

jobs:
  test_and_deploy:
    env:
      RACK_ENV: test
      RAILS_ENV: test
    runs-on: ubuntu-latest
    services:
      postgres:
        ports:
        - 5432:5432
        image: postgres:10.15
        env:
          POSTGRES_DB: mumuki_domain_test
          POSTGRES_USER: mumuki
          POSTGRES_PASSWORD: mumuki
    steps:
    - uses: actions/checkout@v2
    - name: Set up Ruby
      uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
      with:
        ruby-version: 2.6.3
        bundler: 2.1.4
        bundler-cache: true
    - name: Run migrations
      run: bundle exec rake db:schema:load
    - name: Run tests
      run: bundle exec rake
    - name: Deploy
      if: ${{ startsWith(github.ref, 'refs/tags/v') }}
      run: |
        mkdir -p $HOME/.gem
        touch $HOME/.gem/credentials
        chmod 0600 $HOME/.gem/credentials
        printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
        gem build *.gemspec
        gem push *.gem
      env:
        GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"