-
Notifications
You must be signed in to change notification settings - Fork 22
59 lines (59 loc) · 1.6 KB
/
main.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Main
on:
push:
branches: [ main ]
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: tests
steps:
- uses: actions/checkout@v2
- id: version
run: "echo ::set-output name=RUBY_VERSION::$(cat .ruby-version)"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ steps.version.outputs.RUBY_VERSION }}
- name: Cache bundle
uses: actions/cache@v2
with:
path: tests/vendor/bundle
key: ${{ runner.os }}-${{ hashFiles('tests/Gemfile.lock') }}
- name: Bundle
run: |
bundle config set deployment true
bundle
- name: Run tests
run: bundle exec rake
deploy:
needs: test
runs-on: ubuntu-latest
defaults:
run:
working-directory: site
steps:
- uses: actions/checkout@v2
- id: version
run: "echo ::set-output name=RUBY_VERSION::$(cat .ruby-version)"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ steps.version.outputs.RUBY_VERSION }}
- name: Cache bundle
uses: actions/cache@v2
with:
path: site/vendor/bundle
key: ${{ runner.os }}-${{ hashFiles('site/Gemfile.lock') }}
- name: Bundle
run: |
bundle config set deployment true
bundle
- name: Build and deploy
run: |
git config --global user.email [email protected]
git config --global user.name Github Actions
bundle exec rake deploy
env:
GIT_REMOTE: "https://${{github.actor}}:${{github.token}}@github.com/${{github.repository}}.git"