yast-rake 0.2.44 → 0.2.45

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b131d89f00dea687fc5d44232d1cf6ce503659ca2ca810d63b17169d69eb5e00
4
- data.tar.gz: 1e2d455ac8ca10a363b7bf89585f8bf0927dd06c94204d222a1384f421b4270d
3
+ metadata.gz: 44bab584e30b75b55a4b7cbfe7744e98c3b29c0fb0fbc259bb3663aac70a1b5d
4
+ data.tar.gz: fb8b758faff86d93e53658f9b9dcb9a247071fd821882e1992a7d31bf2d3c12b
5
5
  SHA512:
6
- metadata.gz: 5a83c6e94d862c23c0f04e84cdf68d48c0aa4b4f51caba4000a6f5106831097c38343b10a553fc83fd3355e37a9b719befab007656b3a1626b2364b76f8db35a
7
- data.tar.gz: 13828bd3771752722aa0fe5eb0c7f8f305b6f447bf8f0310e71c5df33e4810d5f071fa2cdef39cbcdfc17a2eff2e9e4e12b2f37675aff1c6fbda0d5d4b1b9a24
6
+ metadata.gz: a855254c47f0071b0b29754dff4ec0415f426f72f48532aab8a7bce4e2fa30aabf5aa006ccb5795ce5682a5c343c81c3dc7cc0281b26412e1243996bc229a40e
7
+ data.tar.gz: d4ff9bb5d5307137f1dccb83fb110216a7f2c75bcd36ea0d6e62949f5aa6f1190e3491ab8972a871580e015016b0629e3eea08c26cc596dc50040b2fe6f46629
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.44
1
+ 0.2.45
@@ -22,7 +22,7 @@ module GithubActions
22
22
  # Github Actions job
23
23
  # @see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
24
24
  class Job
25
- attr_reader :name, :steps, :runs_on, :container, :workflow
25
+ attr_reader :name, :steps, :runs_on, :container, :workflow, :matrix
26
26
 
27
27
  # @param name [String] name of the job
28
28
  # @param data [Hash] data from the workflow YAML file
@@ -32,6 +32,7 @@ module GithubActions
32
32
  @runs_on = data["runs-on"]
33
33
  @container = data["container"]
34
34
  @workflow = workflow
35
+ @matrix = data.fetch("strategy", {})["matrix"]
35
36
 
36
37
  @steps = data["steps"].map do |step|
37
38
  Step.new(self, step)
@@ -78,7 +78,23 @@ module GithubActions
78
78
  abort "Unsupported container definition: #{job.container.inspect}"
79
79
  end
80
80
 
81
- Container.new(image_name, options.to_s)
81
+ Container.new(expand_name(image_name), options.to_s)
82
+ end
83
+
84
+ # replace the ${{ matrix.<value> }} placeholders in the image name
85
+ #
86
+ # @param image_name [String] name of the Docker image
87
+ # @return [String] name with replaced values
88
+ def expand_name(image_name)
89
+ image_name.gsub(/\$\{\{\s*matrix\.[^}]*\}\}/) do |subst|
90
+ name = /\$\{\{\s*matrix\.([^}]*)\}\}/.match(subst)[1].strip
91
+ value = job.matrix ? job.matrix[name] : subst
92
+
93
+ # if the value is an Array use the first value by default
94
+ replacement = value.is_a?(Array) ? value.first : value.to_s
95
+ puts "Using ${{matrix.#{name}}} value: #{replacement.inspect}"
96
+ replacement
97
+ end
82
98
  end
83
99
 
84
100
  # run a job step
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yast-rake
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.44
4
+ version: 0.2.45
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josef Reidinger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-10 00:00:00.000000000 Z
11
+ date: 2022-01-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: packaging_rake_tasks