-
Notifications
You must be signed in to change notification settings - Fork 183
/
build.rb
executable file
·72 lines (64 loc) · 1.49 KB
/
build.rb
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#! /usr/bin/env ruby
#
# This script generates GitHub Actions for the currently supported
# set of Snyk images. The Actions all have the same interface.
#
require "erb"
require 'fileutils'
@variants = [
"CocoaPods",
"dotNET",
"Golang",
"Gradle",
"Gradle-jdk11",
"Gradle-jdk12",
"Gradle-jdk14",
"Gradle-jdk16",
"Gradle-jdk17",
"Maven",
"Maven-3-jdk-11",
"Maven-3-jdk-17",
"Maven-3-jdk-20",
"Maven-3-jdk-21",
"Maven-3-jdk-22",
"Node",
"PHP",
"Python",
"Python-3.6",
"Python-3.7",
"Python-3.8",
"Python-3.9",
"Python-3.10",
"Ruby",
"Scala",
"SBT1.10.0-Scala3.4.2",
]
templatename = File.join("_templates", "BASE.md.erb")
renderer = ERB.new(File.read(templatename))
File.open("README.md", "w") { |file| file.puts renderer.result() }
@variants.each do | variant |
puts "Generating Action for #{variant}"
dirname = variant.downcase
unless File.directory?(dirname)
FileUtils.mkdir_p(dirname)
end
@variant = variant
@name, @ident = variant.split("-", 2)
[
"action.yml",
"README.md",
].each do | name |
templatename = File.join("_templates", "#{name}.erb")
renderer = ERB.new(File.read(templatename))
filename = File.join(dirname, name)
File.open(filename, "w") { |file|
file.puts renderer.result()
}
end
end
#
# Currently in order to submit Actions to the marketplace you need to have a file
# called action.yml in the root of your directory
#
#puts "Generating root Action"
#FileUtils.cp("node/action.yml", ".")