licensed 2.14.3 → 2.14.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/release.yml +116 -20
- data/CHANGELOG.md +8 -1
- data/docker/Dockerfile.build-linux +1 -0
- data/lib/licensed/cli.rb +8 -2
- data/lib/licensed/commands/list.rb +7 -0
- data/lib/licensed/reporters/list_reporter.rb +3 -1
- data/lib/licensed/version.rb +1 -1
- data/script/packages/linux +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1042edfc8e49ab1430a73001612f260fb20f80931139649f8b8ae6f044d74463
|
4
|
+
data.tar.gz: 386c548165ed4c4ed1b5b78131635552c11ec03f6a09e8f75e328d1446b129a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c163d4d2bbffe0756b4aecfa353a99d8d3be92ea7fe5b536d00dc79b1581132b31bf69fd0947a85de095ec2d5604da547d175507a199427b1e74da25e8b63a03
|
7
|
+
data.tar.gz: 719df2438ad31e8e525f15ae2b9948f1fc3a0a83b5e72f2e109b10d498f65734d6ab49af99fb92486e31d4314a635a0a2d5bdca793bd51412804b76d9b48042a
|
@@ -3,12 +3,95 @@ name: Build and publish release assets
|
|
3
3
|
on:
|
4
4
|
release:
|
5
5
|
types: [created]
|
6
|
+
workflow_dispatch:
|
7
|
+
inputs:
|
8
|
+
version:
|
9
|
+
description: 'Commit-like version of github/licensed to build package at'
|
10
|
+
required: true
|
11
|
+
release_tag:
|
12
|
+
description: 'Release tag to upload built packages to'
|
13
|
+
required: false
|
6
14
|
|
7
15
|
jobs:
|
16
|
+
vars:
|
17
|
+
name: "Gather values for remainder of steps"
|
18
|
+
runs-on: ubuntu-latest
|
19
|
+
outputs:
|
20
|
+
version: ${{ steps.get_version.outputs.result }}
|
21
|
+
upload_url: ${{ steps.get_url.outputs.result }}
|
22
|
+
ref: ${{ steps.get_ref.outputs.result }}
|
23
|
+
steps:
|
24
|
+
- id: get_version
|
25
|
+
name: Get package version
|
26
|
+
uses: actions/github-script@v3
|
27
|
+
with:
|
28
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
29
|
+
result-encoding: string
|
30
|
+
script: |
|
31
|
+
let version = "${{ github.event.release.tag_name }}"
|
32
|
+
if (!version) {
|
33
|
+
version = "${{ github.event.inputs.version }}"
|
34
|
+
}
|
35
|
+
|
36
|
+
if (!version) {
|
37
|
+
throw new Error("unable to find package build version")
|
38
|
+
}
|
39
|
+
|
40
|
+
return version
|
41
|
+
|
42
|
+
- id: get_url
|
43
|
+
name: Get release upload url
|
44
|
+
uses: actions/github-script@v3
|
45
|
+
with:
|
46
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
47
|
+
result-encoding: string
|
48
|
+
script: |
|
49
|
+
let uploadUrl = "${{ github.event.release.upload_url}}"
|
50
|
+
const tag = "${{ github.event.inputs.release_tag }}"
|
51
|
+
if (!uploadUrl && tag) {
|
52
|
+
const { data: release } = await github.repos.getReleaseByTag({
|
53
|
+
...context.repo,
|
54
|
+
tag
|
55
|
+
})
|
56
|
+
|
57
|
+
if (!release.upload_url) {
|
58
|
+
throw new Error("unable to find a release upload url")
|
59
|
+
}
|
60
|
+
|
61
|
+
uploadUrl = release.upload_url
|
62
|
+
}
|
63
|
+
|
64
|
+
return uploadUrl
|
65
|
+
|
66
|
+
- id: get_ref
|
67
|
+
name: Get checkout ref for custom build scripts
|
68
|
+
uses: actions/github-script@v3
|
69
|
+
with:
|
70
|
+
github-token: ${{ secrets.GITHUB_TOKEN }}
|
71
|
+
result-encoding: string
|
72
|
+
script: |
|
73
|
+
let ref = "${{ github.event.release.tag_name }}"
|
74
|
+
if (!ref) {
|
75
|
+
ref = "${{ github.event.ref }}".replace(/refs\/[^\/]+\//, '')
|
76
|
+
}
|
77
|
+
|
78
|
+
if (!ref) {
|
79
|
+
throw new Error("unable to find a ref for action")
|
80
|
+
}
|
81
|
+
|
82
|
+
return ref
|
83
|
+
|
8
84
|
package_linux:
|
85
|
+
needs: vars
|
9
86
|
runs-on: ubuntu-latest
|
10
87
|
steps:
|
11
88
|
- uses: actions/checkout@v2
|
89
|
+
with:
|
90
|
+
# checkout at the ref for the action, separate from the target build version
|
91
|
+
# this allows running build scripts independent of the target version
|
92
|
+
ref: ${{needs.vars.outputs.ref}}
|
93
|
+
fetch-depth: 0
|
94
|
+
|
12
95
|
- name: Set up Ruby 2.6
|
13
96
|
uses: actions/setup-ruby@v1
|
14
97
|
with:
|
@@ -17,17 +100,24 @@ jobs:
|
|
17
100
|
- name: Build package
|
18
101
|
run: script/packages/linux
|
19
102
|
env:
|
20
|
-
VERSION: ${{
|
103
|
+
VERSION: ${{needs.vars.outputs.version}}
|
21
104
|
|
22
105
|
- uses: actions/upload-artifact@v2
|
23
106
|
with:
|
24
|
-
name: ${{
|
25
|
-
path: pkg/${{
|
107
|
+
name: ${{needs.vars.outputs.version}}-linux
|
108
|
+
path: pkg/${{needs.vars.outputs.version}}/licensed-${{needs.vars.outputs.version}}-linux-x64.tar.gz
|
26
109
|
|
27
110
|
package_mac:
|
111
|
+
needs: vars
|
28
112
|
runs-on: macOS-latest
|
29
113
|
steps:
|
30
114
|
- uses: actions/checkout@v2
|
115
|
+
with:
|
116
|
+
# checkout at the ref for the action, separate from the target build version
|
117
|
+
# this allows running build scripts independent of the target version
|
118
|
+
ref: ${{needs.vars.outputs.ref}}
|
119
|
+
fetch-depth: 0
|
120
|
+
|
31
121
|
- name: Set up Ruby 2.6
|
32
122
|
uses: actions/setup-ruby@v1
|
33
123
|
with:
|
@@ -36,33 +126,39 @@ jobs:
|
|
36
126
|
- name: Build package
|
37
127
|
run: script/packages/mac
|
38
128
|
env:
|
39
|
-
VERSION: ${{
|
129
|
+
VERSION: ${{needs.vars.outputs.version}}
|
40
130
|
|
41
131
|
- uses: actions/upload-artifact@v2
|
42
132
|
with:
|
43
|
-
name: ${{
|
44
|
-
path: pkg/${{
|
133
|
+
name: ${{needs.vars.outputs.version}}-darwin
|
134
|
+
path: pkg/${{needs.vars.outputs.version}}/licensed-${{needs.vars.outputs.version}}-darwin-x64.tar.gz
|
45
135
|
|
46
136
|
build_gem:
|
137
|
+
needs: vars
|
47
138
|
runs-on: ubuntu-latest
|
48
139
|
steps:
|
49
140
|
- uses: actions/checkout@v2
|
141
|
+
with:
|
142
|
+
# building a gem doesn't use a different ref from the version input
|
143
|
+
ref: ${{needs.vars.outputs.version}}
|
144
|
+
|
50
145
|
- name: Set up Ruby 2.6
|
51
146
|
uses: actions/setup-ruby@v1
|
52
147
|
with:
|
53
148
|
ruby-version: 2.6.x
|
54
149
|
|
55
150
|
- name: Build gem
|
56
|
-
run: gem build licensed.gemspec -o licensed-${{
|
151
|
+
run: gem build licensed.gemspec -o licensed-${{needs.vars.outputs.version}}.gem
|
57
152
|
|
58
153
|
- uses: actions/upload-artifact@v2
|
59
154
|
with:
|
60
|
-
name: ${{
|
61
|
-
path: licensed-${{
|
155
|
+
name: ${{needs.vars.outputs.version}}-gem
|
156
|
+
path: licensed-${{needs.vars.outputs.version}}.gem
|
62
157
|
|
63
158
|
upload_packages:
|
159
|
+
if: ${{ needs.vars.outputs.upload_url != '' }}
|
64
160
|
runs-on: ubuntu-latest
|
65
|
-
needs: [package_linux, package_mac, build_gem]
|
161
|
+
needs: [vars, package_linux, package_mac, build_gem]
|
66
162
|
|
67
163
|
steps:
|
68
164
|
- name: Set up Ruby 2.6
|
@@ -73,26 +169,26 @@ jobs:
|
|
73
169
|
- name: Download linux package
|
74
170
|
uses: actions/download-artifact@v2
|
75
171
|
with:
|
76
|
-
name: ${{
|
172
|
+
name: ${{needs.vars.outputs.version}}-linux
|
77
173
|
|
78
174
|
- name: Download macOS package
|
79
175
|
uses: actions/download-artifact@v2
|
80
176
|
with:
|
81
|
-
name: ${{
|
177
|
+
name: ${{needs.vars.outputs.version}}-darwin
|
82
178
|
|
83
179
|
- name: Download gem
|
84
180
|
uses: actions/download-artifact@v2
|
85
181
|
with:
|
86
|
-
name: ${{
|
182
|
+
name: ${{needs.vars.outputs.version}}-gem
|
87
183
|
|
88
184
|
- name: Publish linux package
|
89
185
|
uses: actions/upload-release-asset@v1
|
90
186
|
env:
|
91
187
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
92
188
|
with:
|
93
|
-
upload_url: ${{
|
94
|
-
asset_path: ./licensed-${{
|
95
|
-
asset_name: licensed-${{
|
189
|
+
upload_url: ${{ needs.vars.outputs.upload_url }}
|
190
|
+
asset_path: ./licensed-${{needs.vars.outputs.version}}-linux-x64.tar.gz
|
191
|
+
asset_name: licensed-${{needs.vars.outputs.version}}-linux-x64.tar.gz
|
96
192
|
asset_content_type: application/gzip
|
97
193
|
|
98
194
|
- name: Publish mac package
|
@@ -100,9 +196,9 @@ jobs:
|
|
100
196
|
env:
|
101
197
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
102
198
|
with:
|
103
|
-
upload_url: ${{
|
104
|
-
asset_path: ./licensed-${{
|
105
|
-
asset_name: licensed-${{
|
199
|
+
upload_url: ${{ needs.vars.outputs.upload_url }}
|
200
|
+
asset_path: ./licensed-${{needs.vars.outputs.version}}-darwin-x64.tar.gz
|
201
|
+
asset_name: licensed-${{needs.vars.outputs.version}}-darwin-x64.tar.gz
|
106
202
|
asset_content_type: application/gzip
|
107
203
|
|
108
204
|
- name: Publish gem to RubyGems
|
@@ -114,4 +210,4 @@ jobs:
|
|
114
210
|
gem push $GEM
|
115
211
|
env:
|
116
212
|
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_AUTH_TOKEN}}
|
117
|
-
GEM: licensed-${{
|
213
|
+
GEM: licensed-${{needs.vars.outputs.version}}.gem
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## 2.14.4
|
10
|
+
2021-02-09
|
11
|
+
|
12
|
+
## Added
|
13
|
+
- `list` and `cache` commands optionally print output in JSON or YML formats using the `--format/-f` flag (https://github.com/github/licensed/pull/334)
|
14
|
+
- `list` command will include detected license keys using the `--licenses/-l` flag (https://github.com/github/licensed/pull/334)
|
15
|
+
|
9
16
|
## 2.14.3
|
10
17
|
2020-12-11
|
11
18
|
|
@@ -379,4 +386,4 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|
379
386
|
|
380
387
|
Initial release :tada:
|
381
388
|
|
382
|
-
[Unreleased]: https://github.com/github/licensed/compare/2.14.
|
389
|
+
[Unreleased]: https://github.com/github/licensed/compare/2.14.4...HEAD
|
data/lib/licensed/cli.rb
CHANGED
@@ -12,9 +12,11 @@ module Licensed
|
|
12
12
|
desc: "Path to licensed configuration file"
|
13
13
|
method_option :sources, aliases: "-s", type: :array,
|
14
14
|
desc: "Individual source(s) to evaluate. Must also be enabled via configuration."
|
15
|
+
method_option :format, aliases: "-f", enum: ["yaml", "json"],
|
16
|
+
desc: "Output format"
|
15
17
|
def cache
|
16
18
|
run Licensed::Commands::Cache.new(config: config),
|
17
|
-
force: options[:force], sources: options[:sources]
|
19
|
+
force: options[:force], sources: options[:sources], reporter: options[:format]
|
18
20
|
end
|
19
21
|
|
20
22
|
desc "status", "Check status of dependencies' cached licenses"
|
@@ -33,8 +35,12 @@ module Licensed
|
|
33
35
|
desc: "Path to licensed configuration file"
|
34
36
|
method_option :sources, aliases: "-s", type: :array,
|
35
37
|
desc: "Individual source(s) to evaluate. Must also be enabled via configuration."
|
38
|
+
method_option :format, aliases: "-f", enum: ["yaml", "json"],
|
39
|
+
desc: "Output format"
|
40
|
+
method_option :licenses, aliases: "-l", type: :boolean,
|
41
|
+
desc: "Include detected licenses in output"
|
36
42
|
def list
|
37
|
-
run Licensed::Commands::List.new(config: config), sources: options[:sources]
|
43
|
+
run Licensed::Commands::List.new(config: config), sources: options[:sources], reporter: options[:format], licenses: options[:licenses]
|
38
44
|
end
|
39
45
|
|
40
46
|
desc "notices", "Generate a NOTICE file from cached records"
|
@@ -41,6 +41,13 @@ module Licensed
|
|
41
41
|
#
|
42
42
|
# Returns true.
|
43
43
|
def evaluate_dependency(app, source, dependency, report)
|
44
|
+
report["dependency"] = dependency.name
|
45
|
+
report["version"] = dependency.version
|
46
|
+
|
47
|
+
if options[:licenses]
|
48
|
+
report["license"] = dependency.license_key
|
49
|
+
end
|
50
|
+
|
44
51
|
true
|
45
52
|
end
|
46
53
|
end
|
@@ -75,7 +75,9 @@ module Licensed
|
|
75
75
|
def report_dependency(dependency)
|
76
76
|
super do |report|
|
77
77
|
result = yield report
|
78
|
-
|
78
|
+
info = "#{dependency.name} (#{dependency.version})"
|
79
|
+
info = "#{info}: #{report["license"]}" if report["license"]
|
80
|
+
shell.info " #{info}"
|
79
81
|
|
80
82
|
result
|
81
83
|
end
|
data/lib/licensed/version.rb
CHANGED
data/script/packages/linux
CHANGED
@@ -34,6 +34,9 @@ build_linux_local() {
|
|
34
34
|
sudo apt-get update
|
35
35
|
sudo apt-get install -y --no-install-recommends cmake make gcc pkg-config squashfs-tools curl bison git rsync
|
36
36
|
|
37
|
+
sudo gem update --system
|
38
|
+
sudo gem update bundler
|
39
|
+
|
37
40
|
RUBYC="$BASE_DIR/bin/rubyc-linux"
|
38
41
|
if [ ! -f "$RUBYC" ]; then
|
39
42
|
mkdir -p "$(dirname "$RUBYC")"
|
@@ -42,6 +45,7 @@ build_linux_local() {
|
|
42
45
|
fi
|
43
46
|
|
44
47
|
export CPPFLAGS="-P"
|
48
|
+
export SSL_CERT_DIR="/etc/ssl/certs"
|
45
49
|
export RUBYC
|
46
50
|
"$BASE_DIR"/script/packages/build
|
47
51
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: licensed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.14.
|
4
|
+
version: 2.14.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GitHub
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: licensee
|