File tree Expand file tree Collapse file tree 3 files changed +85
-19
lines changed Expand file tree Collapse file tree 3 files changed +85
-19
lines changed Original file line number Diff line number Diff line change
1
+ name : Publish
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - master
7
+ workflow_dispatch :
8
+
9
+ concurrency : rubygems
10
+
11
+ jobs :
12
+ deploy :
13
+ name : Publish Ruby Gem
14
+ environment : rubygems
15
+ permissions :
16
+ contents : write # needed to be able to tag the release
17
+ runs-on : ubuntu-latest
18
+
19
+ steps :
20
+ - uses : actions/checkout@v2
21
+
22
+ - uses : actions/setup-node@v2
23
+ with :
24
+ cache : ' npm'
25
+ node-version : ' 14'
26
+
27
+ - uses : ruby/setup-ruby@v1
28
+ with :
29
+ bundler-cache : true
30
+
31
+ - name : Check if new version to release
32
+ id : gem_version
33
+ run : |
34
+ gem_version=$(ruby -r rubygems -e "puts Gem::Specification::load('govuk_tech_docs.gemspec)').version")
35
+ echo "::set-output name=gem_version::$gem_version"
36
+
37
+ if git fetch origin "refs/tags/v$gem_version" >/dev/null 2>&1
38
+ then
39
+ echo "Tag 'v$gem_version' already exists"
40
+ echo "::set-output name=new_version::false"
41
+ else
42
+ echo "::set-output name=new_version::true"
43
+ fi
44
+
45
+ - name : Publish
46
+ if : ${{ steps.gem_version.outputs.new_version == 'true' }}
47
+ env :
48
+ RUBYGEMS_API_KEY : ${{ secrets.RUBYGEMS_API_KEY }}
49
+ run : |
50
+ mkdir -p ~/.gem
51
+
52
+ cat << EOF > ~/.gem/credentials
53
+ ---
54
+ :rubygems_api_key: ${RUBYGEMS_API_KEY}
55
+ EOF
56
+
57
+ chmod 0600 ~/.gem/credentials
58
+
59
+ git config user.name "github-actions[bot]"
60
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
61
+
62
+ bundle exec rake release
Original file line number Diff line number Diff line change
1
+ name : Test
2
+
3
+ on : [push, pull_request]
4
+
5
+ jobs :
6
+ test :
7
+ name : Test
8
+ runs-on : ubuntu-latest
9
+
10
+ steps :
11
+ - uses : actions/checkout@v2
12
+
13
+ - uses : actions/setup-node@v2
14
+ with :
15
+ node-version : ' 14'
16
+ cache : ' npm'
17
+
18
+ - uses : ruby/setup-ruby@v1
19
+ with :
20
+ bundler-cache : true
21
+
22
+ - name : Run tests
23
+ run : bundle exec rake
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments