forked from GoCarrot/circleci-orb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRakefile
More file actions
44 lines (36 loc) · 1.09 KB
/
Rakefile
File metadata and controls
44 lines (36 loc) · 1.09 KB
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
# frozen_string_literal: true
require 'tempfile'
ORGANIZATION = 'fasterbetter'.freeze
ORB_NAME = 'omat'.freeze
def with_packed_orb
Tempfile.open('orb') do |file|
`circleci orb pack src > #{file.path}`
puts "Packed orb to `#{file.path}`"
yield file.path
end
end
def promote(label:, version:, verbose: false)
sh "circleci orb publish promote #{ORGANIZATION}/#{ORB_NAME}@#{label} #{version}", verbose: verbose
end
desc 'Validate the orb'
task :validate do
with_packed_orb do |orbfile|
sh "circleci orb validate #{orbfile}", verbose: false
end
end
desc 'Publish the orb to the dev:alpha tag'
task :publish do
with_packed_orb do |orbfile|
sh "circleci orb publish #{orbfile} #{ORGANIZATION}/#{ORB_NAME}@dev:alpha", verbose: false
end
end
desc 'Promote the version at dev:alpha to production and bump the patch release'
namespace :promote do
%w[patch minor major].each do |version|
desc "Promote dev:alpha to production and bump the #{version} in version"
task version.to_sym do
promote(label: 'dev:alpha', version: version)
end
end
task :default => :patch
end