forked from near-rails-guide/borsh-rb
-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (52 loc) · 1.41 KB
/
review_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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Review and deploy
on:
pull_request:
push:
branches:
- master
jobs:
target_name:
runs-on: ubuntu-latest
outputs:
name: ${{steps.branch_name.outputs.current_branch}}
cache_key: ${{steps.cache_key.outputs.key}}
steps:
- uses: actions/checkout@v4
- name: Get branch name
id: branch_name
uses: tj-actions/[email protected]
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run test
run: |
bundle exec rspec
build:
needs:
- tests
- target_name
runs-on: ubuntu-latest
if: ${{needs.target_name.outputs.name == 'master'}}
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Set up authorization
run: |
mkdir -p ~/.gem
touch ~/.gem/credentials
chmod 600 ~/.gem/credentials
echo ":github: Bearer ${{ secrets.GITHUB_TOKEN }}" >> ~/.gem/credentials
- name: Build
run: |
find . -name '*.gemspec' -maxdepth 1 -exec gem build {} \;
- name: Deploy
run: |
find . -name '*.gem' -maxdepth 1 -exec gem push --key github --host "https://rubygems.pkg.github.com/trustfractal" {} \;