-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path.gitlab-ci.yml
54 lines (50 loc) · 1.12 KB
/
.gitlab-ci.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
stages:
- lint
- test
- release
rubocop:
image: ruby:2.6-alpine
stage: lint
variables:
GIT_DEPTH: 1
script:
- gem install rubocop --version=1.3.1
- rubocop --parallel
allow_failure: true
test:
image: registry.gitlab.com/ekylibre/docker-base-images/ruby2.6:1
before_script:
- gem install bundler
- bundle install --path vendor/bundle
cache:
key: bundle
paths:
- vendor/bundle
script:
- bundle exec rake test
allow_failure: true
.rubygems-model: &rubygems-model
image: ruby:2.6-alpine
stage: release
when: manual
only:
- tags
before_script:
- mkdir -p ~/.gem
- cp $RUBYGEMS_CREDENTIALS ~/.gem/credentials
- chmod 0600 /root/.gem/credentials
script:
- |-
VERSION=$(ruby -e "puts Gem::Specification::load('${GEMSPEC}.gemspec').version.to_s.strip")
if [ "$CI_COMMIT_TAG" == "$VERSION" ]
then
gem build "${GEMSPEC}.gemspec"
gem push "${GEMSPEC}-${VERSION}.gem"
else
echo "The version of the Gem does not match the tag!"
exit 1
fi
rubygems:
<<: *rubygems-model
variables:
GEMSPEC: onoma