samus 3.0.8 → 3.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -1
- data/Dockerfile +3 -2
- data/README.md +25 -22
- data/commands/build/changelog-rotate +4 -4
- data/commands/build/changelog-rotate.help.md +1 -1
- data/commands/build/git-clone +13 -1
- data/commands/build/git-clone.help.md +1 -1
- data/lib/samus/builder.rb +1 -0
- data/lib/samus/version.rb +1 -1
- data/samus.json +24 -9
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f04e142129687658a7fd111af0ed1587d9e6d6c2b5d7d5c8b6eaab195940dfa9
|
4
|
+
data.tar.gz: a53a88046167502a858b185831d20217a4542c19a6305b618f9467093231bed6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8613ffe3e5f6106b92c15a527854f1b0e21f0f6c0aba4358a5e77214a169768e75ba7c7be8f80b501a06e28eb7ba29cc822f63ffe89aec378e48982b16af2f70
|
7
|
+
data.tar.gz: b2dbfc18ff675b399cc4e781a62ab461e32669f08a2fb1924a742aa1a7c1289c4d48f82ee1eaefe05d6cfeeffed88ccc4de9e2cc18fd888c02108bfe18e3f7cb
|
data/CHANGELOG.md
CHANGED
data/Dockerfile
CHANGED
@@ -2,8 +2,8 @@ FROM python:3.7-alpine
|
|
2
2
|
|
3
3
|
RUN apk add -U --no-cache openssh ruby ruby-json nodejs git curl
|
4
4
|
RUN pip install awscli
|
5
|
-
RUN gem install bundler
|
6
|
-
RUN gem install rake --no-
|
5
|
+
RUN gem install bundler --no-document
|
6
|
+
RUN gem install rake --no-document
|
7
7
|
RUN mkdir -p ~/.ssh
|
8
8
|
RUN echo "Host *" > ~/.ssh/config
|
9
9
|
RUN echo " StrictHostKeyChecking no" >> ~/.ssh/config
|
@@ -13,6 +13,7 @@ RUN git config --global user.email "bot@not.human"
|
|
13
13
|
RUN git config --global user.name "Samus Release Bot"
|
14
14
|
|
15
15
|
COPY . /samus
|
16
|
+
RUN chmod 755 /samus/commands/build/* /samus/commands/publish/*
|
16
17
|
ENV PATH=$PATH:/samus/bin
|
17
18
|
|
18
19
|
WORKDIR /build
|
data/README.md
CHANGED
@@ -18,7 +18,7 @@ machine.
|
|
18
18
|
Samus is a RubyGem and requires Ruby 1.9.x+. Installing is as easy as typing:
|
19
19
|
|
20
20
|
```sh
|
21
|
-
|
21
|
+
gem install samus
|
22
22
|
```
|
23
23
|
|
24
24
|
If you would rather use Samus via Docker, see the Docker section in Usage below.
|
@@ -44,7 +44,7 @@ manifest file is just a list of discrete actions like so (minus comments):
|
|
44
44
|
"action": "git-push",
|
45
45
|
"arguments": {
|
46
46
|
"remotes": "origin",
|
47
|
-
"refs": "
|
47
|
+
"refs": "main v1.5.0" // the v1.5.0 is a tag for your release
|
48
48
|
}
|
49
49
|
},
|
50
50
|
{
|
@@ -91,9 +91,9 @@ it "samus.json" for easier integration:
|
|
91
91
|
"files": ["lib/my-gem/version.rb"]
|
92
92
|
},
|
93
93
|
{
|
94
|
-
"action": "git-merge", // merge new commit into
|
94
|
+
"action": "git-merge", // merge new commit into main branch
|
95
95
|
"arguments": {
|
96
|
-
"branch": "
|
96
|
+
"branch": "main"
|
97
97
|
}
|
98
98
|
},
|
99
99
|
{
|
@@ -103,7 +103,7 @@ it "samus.json" for easier integration:
|
|
103
103
|
"action": "git-push",
|
104
104
|
"arguments": {
|
105
105
|
"remotes": "origin",
|
106
|
-
"refs": "
|
106
|
+
"refs": "main v$version"
|
107
107
|
}
|
108
108
|
}]
|
109
109
|
},
|
@@ -123,12 +123,12 @@ it "samus.json" for easier integration:
|
|
123
123
|
```
|
124
124
|
|
125
125
|
It looks a little longer, but it contains all of the steps to automate when
|
126
|
-
bumping the VERSION constant, tagging a version, merging into the
|
126
|
+
bumping the VERSION constant, tagging a version, merging into the primary
|
127
127
|
branch, and building the gem. To build a release with this manifest, simply
|
128
128
|
type:
|
129
129
|
|
130
130
|
```sh
|
131
|
-
|
131
|
+
samus build 1.5.0
|
132
132
|
```
|
133
133
|
|
134
134
|
Samus will look for `samus.json` and build a release for version 1.5.0 of your
|
@@ -136,10 +136,10 @@ code. It will produce an archive called `release-v1.5.0.tar.gz` that you
|
|
136
136
|
can then publish with:
|
137
137
|
|
138
138
|
```sh
|
139
|
-
|
139
|
+
samus publish release-v1.5.0.tar.gz
|
140
140
|
```
|
141
141
|
|
142
|
-
You may have noticed some funny looking "
|
142
|
+
You may have noticed some funny looking "\$version" strings in the above
|
143
143
|
manifest. Those strings will be replaced with the version provided in the
|
144
144
|
build command, so all the correct tagging and building will be handled for you.
|
145
145
|
|
@@ -227,14 +227,14 @@ repositories. In this case, you can simply type `samus install REPO` to
|
|
227
227
|
download the repository to your machine:
|
228
228
|
|
229
229
|
```sh
|
230
|
-
|
230
|
+
samus install git@github.com:my_org/samus_config
|
231
231
|
```
|
232
232
|
|
233
233
|
Of course, Samus doesn't need these custom packages to be Git-backed. All
|
234
234
|
the above command does is clone a repository into the ~/.samus directory.
|
235
235
|
The above command creates:
|
236
236
|
|
237
|
-
```
|
237
|
+
```plaintext
|
238
238
|
.samus/
|
239
239
|
`- samus_config/
|
240
240
|
`- commands/
|
@@ -274,18 +274,20 @@ commands directory depending on whether they are for `samus build` or
|
|
274
274
|
In addition to exposing arguments as underscored environment variables,
|
275
275
|
Samus also exposes a few special variables with double underscore prefixes:
|
276
276
|
|
277
|
-
- `
|
277
|
+
- `__BUILD_DIR` - this variable refers to the temporary directory that the
|
278
278
|
release package is being built inside of. The files inside of this directory,
|
279
279
|
and _only_ the files inside of this directory, will be built into the release
|
280
280
|
archive. If you write a build-time command that produces an output file which
|
281
281
|
is part of the release, you should make sure to move it into this directory.
|
282
|
-
- `
|
282
|
+
- `__ORIG_BRANCH` - the original branch being built from.
|
283
|
+
- `__BUILD_BRANCH` - the name of the branch being built to.
|
284
|
+
- `__RESTORE_FILE` - the restore file is a newline delimited file containing
|
283
285
|
branches and their original ref. All branches listed in this file will be
|
284
286
|
restored to the respective ref at the end of `samus build` regardless of
|
285
287
|
success status. If you make destructive modifications to existing branches
|
286
288
|
in the workspace repository, you should add the original ref for the branch
|
287
289
|
to this file.
|
288
|
-
- `
|
290
|
+
- `__CREDS_*` - provides key, secret, and other values loaded from credentials.
|
289
291
|
See Credentials section for more information on how these are set.
|
290
292
|
|
291
293
|
#### Help Files
|
@@ -295,14 +297,15 @@ command should include a file named `your-command.help.md` in the same directory
|
|
295
297
|
as the command script itself. These files are Markdown-formatted files and
|
296
298
|
should follow the same structure of the built-in command help files:
|
297
299
|
|
298
|
-
```
|
300
|
+
```markdown
|
299
301
|
Short description of command.
|
300
302
|
|
301
|
-
|
302
|
-
|
303
|
+
- Files:
|
304
|
+
|
305
|
+
- Description of what the command line arguments are
|
303
306
|
|
304
|
-
|
305
|
-
|
307
|
+
- Arguments:
|
308
|
+
- argname: Documentation for argument
|
306
309
|
```
|
307
310
|
|
308
311
|
Notes:
|
@@ -425,7 +428,7 @@ property:
|
|
425
428
|
|
426
429
|
The "condition" property is a Ruby expression that is evaluated for truthiness
|
427
430
|
to decide if the action item should be evaluated or skipped. A common use for
|
428
|
-
this is to take action based on the version (see "
|
431
|
+
this is to take action based on the version (see "\$version" variable section
|
429
432
|
below). The following example runs an action item only for version 2.0+ of a
|
430
433
|
release:
|
431
434
|
|
@@ -437,9 +440,9 @@ release:
|
|
437
440
|
}
|
438
441
|
```
|
439
442
|
|
440
|
-
#### "
|
443
|
+
#### "\$version" Variable
|
441
444
|
|
442
|
-
A special variable "
|
445
|
+
A special variable "\$version" is interpolated when loading the build manifest.
|
443
446
|
This variable can appear anywhere in the JSON document, and is interpolated
|
444
447
|
before any actions or conditions are evaluated.
|
445
448
|
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
file = ARGV[0]
|
4
4
|
ver = ENV['_VERSION']
|
5
|
-
|
5
|
+
heading = ENV['_HEADING'] || ENV['_MASTER'] || ENV['__ORIG_BRANCH']
|
6
6
|
title_fmt = ENV['_TITLE_FORMAT'] || "[$version] - %B %-d$day_nth, %Y"
|
7
7
|
ENV['TZ'] ||= ENV['_TZ']
|
8
8
|
|
@@ -11,11 +11,11 @@ compare_url = `git config remote.origin.url`.strip.sub(/^git@(.+?):/, 'https://\
|
|
11
11
|
day_nth = {1 => 'st', 2 => 'nd', 3 => 'rd'}[Time.now.day % 10] || 'th'
|
12
12
|
title = Time.now.strftime(title_fmt).sub('$version', ver).sub('$day_nth', day_nth)
|
13
13
|
|
14
|
-
match = /\A\s*# #{
|
15
|
-
raise "Failed to rotate changelog: #{file}" unless match
|
14
|
+
match = /\A\s*# #{heading}\r?\n(?<body>.*?)(?<rest>\r?\n# .+|\Z)/mis.match(content)
|
15
|
+
raise "Failed to rotate changelog: #{file} (invalid heading: #{heading})" unless match
|
16
16
|
|
17
17
|
prev_ver = match['rest'][/(\d+\.\d+(?:\.\d+)?)/, 1]
|
18
|
-
repl = "# #{
|
18
|
+
repl = "# #{heading}\n\n# #{title}\n\n" +
|
19
19
|
(prev_ver ? "[#{ver}]: #{compare_url}/compare/v#{prev_ver}...v#{ver}\n" : '') +
|
20
20
|
match['body'] + match['rest']
|
21
21
|
File.open(file, 'w') {|f| f.write(repl) }
|
@@ -8,7 +8,7 @@ Files:
|
|
8
8
|
|
9
9
|
Arguments:
|
10
10
|
|
11
|
-
-
|
11
|
+
- heading: (optional) defaults to primary branch name, should match the first development
|
12
12
|
heading used for in-flux changelog entries before rotation.
|
13
13
|
- title_format: (optional) a `Time.strftime` date formatted string that can
|
14
14
|
also include `$version` to represent the title of the rotated changelog entry.
|
data/commands/build/git-clone
CHANGED
@@ -1,8 +1,20 @@
|
|
1
1
|
#!/bin/sh
|
2
2
|
|
3
3
|
set -e
|
4
|
-
|
4
|
+
|
5
|
+
cd ${_REPOSITORY-.}
|
6
|
+
BRANCHES=`git branch --list --format="%(refname:lstrip=2)"`
|
7
|
+
|
8
|
+
git clone -q $([ -n "$_BRANCH" ] && echo --branch $_BRANCH) \
|
5
9
|
${_REPOSITORY-.} $__BUILD_DIR/$1 2>${__DEVNULL-/dev/null}
|
6
10
|
|
11
|
+
oldpw=`pwd`
|
12
|
+
cd $__BUILD_DIR/$1
|
13
|
+
for branch in $BRANCHES; do
|
14
|
+
echo Copying over $branch from repository.
|
15
|
+
git branch $branch --track origin/$branch 2>${__DEVNULL-/dev/null} || true
|
16
|
+
done
|
17
|
+
cd $oldpw
|
18
|
+
|
7
19
|
# preserve all previously configured remotes for publish actions
|
8
20
|
cp ${_REPOSITORY-.}/.git/config $__BUILD_DIR/$1/.git/config
|
data/lib/samus/builder.rb
CHANGED
data/lib/samus/version.rb
CHANGED
data/samus.json
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
"actions": [
|
3
3
|
{
|
4
4
|
"action": "fs-sedfiles",
|
5
|
-
"files": [
|
5
|
+
"files": [
|
6
|
+
"lib/*/version.rb"
|
7
|
+
],
|
6
8
|
"arguments": {
|
7
9
|
"search": "VERSION = ['\"](.+?)['\"]",
|
8
10
|
"replace": "VERSION = '$version'"
|
@@ -10,7 +12,9 @@
|
|
10
12
|
},
|
11
13
|
{
|
12
14
|
"action": "changelog-rotate",
|
13
|
-
"files": [
|
15
|
+
"files": [
|
16
|
+
"CHANGELOG.md"
|
17
|
+
],
|
14
18
|
"arguments": {
|
15
19
|
"title_format": "$version - %B %-d$day_nth, %Y",
|
16
20
|
"tz": "GMT+8"
|
@@ -27,42 +31,53 @@
|
|
27
31
|
},
|
28
32
|
{
|
29
33
|
"action": "git-commit",
|
30
|
-
"files": [
|
34
|
+
"files": [
|
35
|
+
"CHANGELOG.md",
|
36
|
+
"lib/*/version.rb"
|
37
|
+
]
|
31
38
|
},
|
32
39
|
{
|
33
40
|
"action": "git-merge",
|
34
41
|
"arguments": {
|
35
|
-
"branch": "
|
42
|
+
"branch": "main"
|
36
43
|
}
|
37
44
|
},
|
38
45
|
{
|
39
46
|
"action": "git-clone",
|
40
|
-
"files": [
|
47
|
+
"files": [
|
48
|
+
"git-repo"
|
49
|
+
],
|
41
50
|
"publish": [
|
42
51
|
{
|
43
52
|
"action": "git-push",
|
44
53
|
"credentials": "lsegal.github.ssh",
|
45
54
|
"arguments": {
|
46
55
|
"remotes": "origin",
|
47
|
-
"refs": "
|
56
|
+
"refs": "main v$version"
|
48
57
|
}
|
49
58
|
}
|
50
59
|
]
|
51
60
|
},
|
52
61
|
{
|
53
62
|
"action": "gem-build",
|
54
|
-
"files": [
|
63
|
+
"files": [
|
64
|
+
"*.gemspec"
|
65
|
+
],
|
55
66
|
"publish": [
|
56
67
|
{
|
57
68
|
"action": "gem-push",
|
58
|
-
"files": [
|
69
|
+
"files": [
|
70
|
+
"*.gem"
|
71
|
+
],
|
59
72
|
"credentials": "lsegal.rubygems"
|
60
73
|
}
|
61
74
|
]
|
62
75
|
},
|
63
76
|
{
|
64
77
|
"action": "changelog-parse",
|
65
|
-
"files": [
|
78
|
+
"files": [
|
79
|
+
"CHANGELOG.md"
|
80
|
+
],
|
66
81
|
"publish": [
|
67
82
|
{
|
68
83
|
"action": "github-release",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: samus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Loren Segal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email: lsegal@soen.ca
|
@@ -115,8 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
- !ruby/object:Gem::Version
|
116
116
|
version: '0'
|
117
117
|
requirements: []
|
118
|
-
|
119
|
-
rubygems_version: 2.7.6
|
118
|
+
rubygems_version: 3.1.2
|
120
119
|
signing_key:
|
121
120
|
specification_version: 4
|
122
121
|
summary: Samus helps you release Open Source Software.
|