File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change 1414
1515 steps :
1616
17+ - name : " Set up Ruby"
18+ uses : " actions/setup-ruby@v1"
19+ with :
20+ ruby-version : " 3.1"
21+
1722 - name : " Checkout"
1823 uses : " actions/checkout@v4"
1924 with :
2429 - name : " Get version"
2530 id : " get_version"
2631 run : |
27- echo "version=$(jq --raw-output .version metadata.json)" >> $GITHUB_OUTPUT
32+ ruby <<-EOF >> $GITHUB_OUTPUT
33+ require "json"
34+ version = JSON.parse(File.read("metadata.json"))["version"]
35+
36+ # from https://github.com/voxpupuli/metadata-json-lint/blob/b5e68049c6be58aa63263357bb0dcad8635a6829/lib/metadata-json-lint/schema.rb#L141-L150
37+ numeric = '(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)' # Major . Minor . Patch
38+ pre = '(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?' # Prerelease
39+ build = '(?:\+([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?' # Build
40+ full = numeric + pre + build
41+ semver_regex = /\A#{full}\Z/
42+ if version&.match?(semver_regex)
43+ puts "version=#{version}"
44+ else
45+ raise "Version #{version} is invalid. Exiting workflow."
46+ end
47+ EOF
2848
2949 - name : " PDK build"
3050 uses : " docker://puppet/pdk:nightly"
You can’t perform that action at this time.
0 commit comments