-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (42 loc) · 1.11 KB
/
test_and_deploy.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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_bibliotheca_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}}"