File tree Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Expand file tree Collapse file tree 1 file changed +6
-7
lines changed Original file line number Diff line number Diff line change 14
14
15
15
steps :
16
16
17
+ - name : " Set up Ruby"
18
+ uses : " actions/setup-ruby@v1"
19
+ with :
20
+ ruby-version : " 3.1"
21
+
17
22
- name : " Checkout"
18
23
uses : " actions/checkout@v4"
19
24
with :
24
29
- name : " Get version"
25
30
id : " get_version"
26
31
run : |
27
- version=$(jq --raw-output '.version | gsub("[^0-9.]"; "")' metadata.json)
28
- if [ -z "$version" ]; then
29
- echo "Version is empty. Exiting workflow."
30
- failure "Failed to retrieve version from metadata.json"
31
- else
32
- echo "version=$version" >> $GITHUB_OUTPUT
33
- fi
32
+ ruby -e 'require "json"; version = JSON.parse(File.read("metadata.json"))["version"]; semver_regex = /\A(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?\z/; if version&.match?(semver_regex); puts "version=#{version}"; else; raise "Version #{version} is invalid. Exiting workflow."; end' >> $GITHUB_OUTPUT
34
33
35
34
- name : " PDK build"
36
35
uses : " docker://puppet/pdk:nightly"
You can’t perform that action at this time.
0 commit comments