Merge pull request #1640 from coderdojo-japan/dependabot/bundler/rexm… #1565
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
name: actions | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- "*" | |
# Allows you to run this workflow manually from the Actions tab | |
# https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow | |
workflow_dispatch: | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
env: | |
DATABASE_HOST: localhost | |
DATABASE_USER: postgres | |
DATABASE_PASSWORD: password | |
DATABASE_PORT: 5432 | |
TZ: Asia/Tokyo | |
services: | |
db: | |
image: postgres:10.4-alpine | |
ports: | |
- 5432:5432 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
steps: | |
- name: ☑️ Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 | |
- name: 💎 Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: 🧪 Prepare DB | |
run: | | |
bundle exec rails db:create | |
bundle exec rails db:setup | |
- name: 🔧 Test | |
run: bundle exec rspec spec | |
deploy: | |
needs: test | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: akhileshns/[email protected] | |
with: | |
heroku_api_key: ${{ secrets.HEROKU_API_KEY }} | |
heroku_app_name: ${{ secrets.HEROKU_APP_NAME }} | |
heroku_email: ${{ secrets.HEROKU_EMAIL }} |