-
Notifications
You must be signed in to change notification settings - Fork 19
72 lines (60 loc) · 2.18 KB
/
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
68
69
70
71
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support documentation.
# This workflow will download a prebuilt Ruby version, install dependencies, build and deploy/publish a new release
name: Deploy and Publish
on:
workflow_run:
workflows: ["Build and Test"]
branches: [ master ]
types:
- completed
# Allows you to run this workflow manually from the Action tab
workflow_dispatch:
jobs:
deploy:
if: "!contains(github.event.head_commit.message, 'skip ci')"
name: Deploy and Publish
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
persist-credentials: false
- name: Set up Ruby 2.5
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.5
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Execute Ruby unit tests
run: bundle exec rake test:unit
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 14
- name: Install Semantic Release dependencies
run: |
sudo apt-get install bumpversion
npm install -g semantic-release
npm install -g @semantic-release/changelog
npm install -g @semantic-release/exec
npm install -g @semantic-release/git
npm install -g @semantic-release/github
npm install -g @semantic-release/commit-analyzer
- name: Publish to Git Releases and Tags
if: ${{ github.event.workflow_run.conclusion == 'success' }}
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release # --dry-run
- name: Publish to RubyGems
if: ${{ github.event.workflow_run.conclusion == 'success' }}
continue-on-error: true
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_API_KEY}}"
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