toys-release 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/docs/guide.md +532 -37
- data/lib/toys/release/version.rb +1 -1
- data/toys/.lib/toys/release/pipeline.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 2a2ec831144ec904f29bedffdc558c426447b4d0fe28f960dff189689f02ca03
|
|
4
|
+
data.tar.gz: 2ce6d38ede95e613c883f32df9d4592ba6228af96a8da9128da1eae0e760134e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5dddfaa0f0b174b388d1c7c37271f69e2ae6ee79b2f80d641e36760339ce0881e61ee831095b40ee647455d9013287ec89f6f362f641eaff3526715d71467a07
|
|
7
|
+
data.tar.gz: db8463f7cacbac2eda9f904d481bcfcbecca7221e9584918708511ef0ee6dc10d46d2921ae978195b9bec8af0de1e8ed26db1495373c9007558916994e25aa5c
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
+
### v0.3.1 / 2025-12-22
|
|
4
|
+
|
|
5
|
+
* FIXED: Reset the local repository prior to each pipeline step
|
|
6
|
+
* DOCS: Updates to readmes and users guides
|
|
7
|
+
|
|
3
8
|
### v0.3.0 / 2025-12-06
|
|
4
9
|
|
|
5
10
|
This release includes fairly substantial changes, a few of them breaking, to the configuration mechanism:
|
data/docs/guide.md
CHANGED
|
@@ -18,8 +18,6 @@ This user's guide covers all the features of Toys-Release in detail, including
|
|
|
18
18
|
installation, normal operations, release pipeline customization, and a full
|
|
19
19
|
configuration reference.
|
|
20
20
|
|
|
21
|
-
**(This user's guide is still under construction.)**
|
|
22
|
-
|
|
23
21
|
## Conceptual overview
|
|
24
22
|
|
|
25
23
|
Toys-Release is a comprehensive release pipeline system. It includes a set of
|
|
@@ -178,25 +176,97 @@ and interact with the process.
|
|
|
178
176
|
|
|
179
177
|
Overall, the process looks like this:
|
|
180
178
|
|
|
181
|
-
1.
|
|
179
|
+
1. During development, commit messages for all commits should be formatted
|
|
180
|
+
according to the [Conventional Commits](https://conventionalcommits.org)
|
|
181
|
+
standard. This allows Toys-Release (and other similar tools) to interpret
|
|
182
|
+
the semantics of your changes and configure releases accordingly.
|
|
183
|
+
|
|
184
|
+
2. A maintainer schedules a release by triggering the "Open release request"
|
|
182
185
|
GitHub Action. This action analyzes the repository, looking for changes in
|
|
183
186
|
each component, deciding which components have releasable updates,
|
|
184
187
|
determining the semver version bump for each, and building a changelog. It
|
|
185
188
|
then opens a pull request with the version and changelog updates.
|
|
186
189
|
|
|
187
|
-
|
|
190
|
+
3. The maintainer can either merge the pull request (possibly with manual
|
|
188
191
|
modifications to the changelogs and/or version numbers to release) or close
|
|
189
192
|
it unmerged.
|
|
190
193
|
|
|
191
|
-
|
|
194
|
+
4. If the pull request is merged, the release is automatically processed by
|
|
192
195
|
additional GitHub Actions. The automation verifies that the GitHub checks
|
|
193
196
|
pass, and runs the release pipeline.
|
|
194
197
|
|
|
195
|
-
|
|
198
|
+
5. The results of the run are reported back to the release pull request. If
|
|
196
199
|
the release failed, a GitHub issue is also automatically opened. A
|
|
197
200
|
maintainer can retry a failed release by triggering the "Retry release"
|
|
198
201
|
GitHub Action.
|
|
199
202
|
|
|
203
|
+
### Commit message formatting
|
|
204
|
+
|
|
205
|
+
When using Toys-Release, you should format all commit messages according to the
|
|
206
|
+
[Conventional Commits](https://conventionalcommits.org) standard. This allows
|
|
207
|
+
Toys-Release (and other similar tools) to interpret the semantics of your
|
|
208
|
+
changes and configure releases accordingly. (Even if you are not using such
|
|
209
|
+
tools, Conventional Commits encapsulates good best practice for writing useful
|
|
210
|
+
commit messages.) Properly formatted conventional commit messages will
|
|
211
|
+
determine what kind of version bump Toys-Release uses when releasing those
|
|
212
|
+
changes, and the commit messages themselves will be used in the changelog that
|
|
213
|
+
Toys-Release generates.
|
|
214
|
+
|
|
215
|
+
Specifically, a change that adds a new feature, corresponding to a minor update
|
|
216
|
+
under [Semantic Versioning](https://semver.org), should have a commit message
|
|
217
|
+
tagged with `feat:`. For example:
|
|
218
|
+
|
|
219
|
+
```
|
|
220
|
+
feat: You can now upload a cat photo
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
A change that fixes a bug, corresponding to a patch change under Semver, should
|
|
224
|
+
have a commit message tagged with `fix:`. For example:
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
fix: The app no longer crashes when a photo includes a dog instead of a cat
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
A change that updates documentation should have a commit message tagged with
|
|
231
|
+
`docs:`. For example:
|
|
232
|
+
|
|
233
|
+
```
|
|
234
|
+
docs: Emphasize that photos should include cats rather than dogs
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
A breaking change, which would trigger a major update under Semver, can be
|
|
238
|
+
expressed using either the `BREAKING CHANGE:` tag, or an exclamation mark after
|
|
239
|
+
any other type of tag. Here are a few examples:
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
BREAKING CHANGE: Rename the "add-photo" API to "add-cat-photo"
|
|
243
|
+
feat!: Raise an exception if a photo contains a dog instead of a cat
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
A change that does not actually make any functional change, such as a git
|
|
247
|
+
repository configuration change, a CI change, or other admin-level change,
|
|
248
|
+
should be tagged with `chore:`. For example:
|
|
249
|
+
|
|
250
|
+
```
|
|
251
|
+
chore: Attach a photo of a cat to the repo
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Other common tags might include `refactor:`, `style:`, `test:`, and others. See
|
|
255
|
+
https://conventionalcommits.org for more details and discussion.
|
|
256
|
+
|
|
257
|
+
By default, Toys-Release specifically recognizes the `feat:`, `fix:`, and
|
|
258
|
+
`docs:` tags, and uses them to configure releases and new versions. It also
|
|
259
|
+
recognizes breaking changes. It considers other tags to be non-significant for
|
|
260
|
+
release purposes. However, you can configure this behavior using the
|
|
261
|
+
**commit_tags** configuration field. See the
|
|
262
|
+
[configuration reference](#configuration-reference) for more details.
|
|
263
|
+
|
|
264
|
+
It is legal to have multiple conventional commit formatted messages in a single
|
|
265
|
+
commit message. Toys-Release will parse each commit message and use all
|
|
266
|
+
properly formatted conventional commit messages it finds. In most cases,
|
|
267
|
+
however, it is good practice to keep commits small and describable via a single
|
|
268
|
+
conventional commit message.
|
|
269
|
+
|
|
200
270
|
### Requesting releases
|
|
201
271
|
|
|
202
272
|
To request a release, navigate to the Actions tab in the GitHub UI, select the
|
|
@@ -242,8 +312,8 @@ workflow will have the `release: pending` label applied. This label signals the
|
|
|
242
312
|
release automation that this is a release pull request. If you remove this
|
|
243
313
|
label, the automation will not process the release.
|
|
244
314
|
|
|
245
|
-
Finally, you can even create a release pull request manually
|
|
246
|
-
ensure that:
|
|
315
|
+
Finally, you can even create a release pull request manually, or using your own
|
|
316
|
+
tools or processes. You must simply ensure that:
|
|
247
317
|
|
|
248
318
|
* The pull request has the `release: pending` label applied
|
|
249
319
|
* The pull request merges as a single commit (i.e. "squashed")
|
|
@@ -254,25 +324,227 @@ If you close a release pull request without merging, the release will be
|
|
|
254
324
|
canceled. The automation will apply the `release: aborted` label to indicate
|
|
255
325
|
this.
|
|
256
326
|
|
|
257
|
-
###
|
|
258
|
-
|
|
259
|
-
|
|
327
|
+
### Monitoring progress and results
|
|
328
|
+
|
|
329
|
+
After a release pull request is merged, a GitHub Actions workflow will trigger
|
|
330
|
+
and begin processing the release. You can follow the workflow logs if you want
|
|
331
|
+
detailed information on the progress of the release. Additionally, updates will
|
|
332
|
+
be posted to the pull request when the workflow begins and when it completes.
|
|
333
|
+
These updates will include a link to the workflow logs for your convenience.
|
|
334
|
+
|
|
335
|
+
After a workflow finishes, it will apply a label to the pull request indicating
|
|
336
|
+
the final result. A successful release will have the `release: complete` label,
|
|
337
|
+
while an unsuccessful release will have the `release: error` label. If an error
|
|
338
|
+
occurred, the workflow will also open an issue in the repository reporting the
|
|
339
|
+
failed release.
|
|
340
|
+
|
|
341
|
+
Most of the useful workflow logs will appear in the "Process release request"
|
|
342
|
+
job under the workflow. If you follow the logs, you will see the release goes
|
|
343
|
+
through the following stages:
|
|
344
|
+
|
|
345
|
+
* First, it publishes a comment to the pull request indicating that the release
|
|
346
|
+
is starting.
|
|
347
|
+
* Second, it polls the GitHub checks for the merge commit. Toys-Release will
|
|
348
|
+
perform a release only if all required checks pass, so the release job will
|
|
349
|
+
wait for them to complete. If any checks fail, the release will fail.
|
|
350
|
+
* Third, it runs a set of sanity checks, for example that it is looking at the
|
|
351
|
+
correct repository and commit, that there are no locally modified files, and
|
|
352
|
+
that the version numbers are set as expected.
|
|
353
|
+
* Next, it runs the release pipeline itself. It first does an analysis of which
|
|
354
|
+
steps in the pipeline should run, then runs those steps in order.
|
|
355
|
+
* Finally, it publishes a comment to the pull request reporting the final
|
|
356
|
+
result of the release.
|
|
260
357
|
|
|
261
358
|
### Troubleshooting and retrying releases
|
|
262
359
|
|
|
263
|
-
|
|
360
|
+
If a release fails, generally an issue will be opened in the repository, and
|
|
361
|
+
the pull request will have the `release: error` label applied. Releases can
|
|
362
|
+
fail for a number of reasons, including:
|
|
363
|
+
|
|
364
|
+
* The GitHub checks for the commit representing the merge of the release pull
|
|
365
|
+
request, have failed or did not complete in a timely manner.
|
|
366
|
+
* A failure during the release pipeline, such as an error during the build or
|
|
367
|
+
publication of a release artifact.
|
|
368
|
+
* An intermittent failure of the release pipeline infrastructure, such as a
|
|
369
|
+
failure to obtain a VM to execute a GitHub Actions workflow.
|
|
370
|
+
|
|
371
|
+
If a failure occurs, the release workflow may have published some basic
|
|
372
|
+
information on the cause, to the release pull request. You can also find more
|
|
373
|
+
detailed information in the release logs, a link to which should also have been
|
|
374
|
+
published in the pull request comments. You should use this information to
|
|
375
|
+
troubleshoot the release.
|
|
376
|
+
|
|
377
|
+
In many cases, you can retry the release, possibly after doing something to
|
|
378
|
+
address the cause. For example, if the release failed because of a flaky test
|
|
379
|
+
in the GitHub checks, you can rerun the check, and once it passes, retry the
|
|
380
|
+
release. Or, if the release failed because of expired RubyGems credentials, you
|
|
381
|
+
can rotate the credentials (see [above](#provide-credentials)) and then retry
|
|
382
|
+
the release.
|
|
383
|
+
|
|
384
|
+
To retry a release, navigate to the Actions tab in the GitHub UI, select the
|
|
385
|
+
"Retry release" workflow, and click the "Run workflow" dropdown. This will open
|
|
386
|
+
a confirmation drop-down with a field for "Release PR number". Enter the number
|
|
387
|
+
of the *release pull request* here, and then click the "Run workflow" button to
|
|
388
|
+
retry the release.
|
|
389
|
+
|
|
390
|
+
When a failure takes place, it is possible that the release partially completed
|
|
391
|
+
but did not fully complete. For example, a GitHub release and tag may already
|
|
392
|
+
have been created, but the gem was not successfully pushed to RubyGems. When
|
|
393
|
+
you retry a release, the release script will automatically detect which release
|
|
394
|
+
steps were already completed, and will skip them.
|
|
395
|
+
|
|
396
|
+
If you need to "roll back" a failed release so it can be retried from a
|
|
397
|
+
different commit, currently you must manually roll back the version number and
|
|
398
|
+
changelog modification (i.e. roll back the changes in the release pull
|
|
399
|
+
request). You might also need to remove an existing GitHub tag and release if
|
|
400
|
+
they were already created.
|
|
401
|
+
|
|
402
|
+
## Other features
|
|
264
403
|
|
|
265
404
|
### Documentation publication
|
|
266
405
|
|
|
267
|
-
|
|
406
|
+
One of the optional features of the release pipeline is publication of Yardoc
|
|
407
|
+
reference documentation to GitHub Pages. This lets you host reference
|
|
408
|
+
documentation for your Ruby gem on your GitHub Pages site, under github.io. As
|
|
409
|
+
an example, of what this looks like you can see the reference documentation for
|
|
410
|
+
the Toys gem at https://dazuma.github.io/toys/gems/toys.
|
|
411
|
+
|
|
412
|
+
The features of this system are:
|
|
413
|
+
|
|
414
|
+
* Host generated Yardoc (or rdoc) documentation for every version of the gem.
|
|
415
|
+
* Host documentation for multiple gems per repository.
|
|
416
|
+
* Permanent GitHub Pages (github.io) URL for each gem, which redirects to the
|
|
417
|
+
documentation for the latest version.
|
|
418
|
+
* Automatically publish documentation with each release.
|
|
419
|
+
|
|
420
|
+
#### Setting up documentation publication
|
|
421
|
+
|
|
422
|
+
To set up documentation, do the following:
|
|
423
|
+
|
|
424
|
+
* [Install the release tool](#install-the-release-tool) as documented in the
|
|
425
|
+
main setup procedure. This provides access to the Toys-Release command line.
|
|
426
|
+
|
|
427
|
+
* Make sure you have a release config file. See the section on
|
|
428
|
+
[writing the configuration file](#write-the-configuration-file) for how to
|
|
429
|
+
get started here.
|
|
430
|
+
|
|
431
|
+
* For each gem that you want documented, include the configuration setting
|
|
432
|
+
`gh_pages_enabled: true` in the component's configuration. Alternately, you
|
|
433
|
+
can set `gh_pages_enabled: true` at the top level of the configuration file
|
|
434
|
+
to enable documenting for all components.
|
|
435
|
+
|
|
436
|
+
* Create a starting gh-pages branch by running:
|
|
437
|
+
|
|
438
|
+
toys release gen-gh-pages
|
|
268
439
|
|
|
269
|
-
|
|
440
|
+
This will generate the gh-pages branch and push some key files to it, notably
|
|
441
|
+
a `404.html` that does the redirecting to the latest documentation version.
|
|
442
|
+
This may clobber any other gh-pages that you have present.
|
|
270
443
|
|
|
271
|
-
|
|
444
|
+
From this point on, any releases you do should also publish documentation to
|
|
445
|
+
your page. To find the page, use the URL
|
|
446
|
+
`https://<github-user>.github.io/<repo-name>/<component-name>`.
|
|
447
|
+
|
|
448
|
+
If you add or otherwise change your components, you can rerun the
|
|
449
|
+
`toys release gen-gh-pages` script to regenerate the files and update the
|
|
450
|
+
redirects. This will not affect any actual documentation you may have generated
|
|
451
|
+
previously.
|
|
452
|
+
|
|
453
|
+
#### Special configuration
|
|
454
|
+
|
|
455
|
+
There are a few configuration fields that affect documentation publication.
|
|
456
|
+
|
|
457
|
+
* **gh_pages_directory** is the directory name for this component in the
|
|
458
|
+
documentation URL. This takes the place of the `<component-name>` in the URL.
|
|
459
|
+
For example, if you set `gh_pages_directory: foo/bar` for your component, the
|
|
460
|
+
documentation will be generated under the URL:
|
|
461
|
+
`https://<github-user>.github.io/<repo-name>/foo/bar`.
|
|
462
|
+
|
|
463
|
+
Note that if you modify this field after previously generating documentation
|
|
464
|
+
for some releases, you will need to manually move the previous documentation
|
|
465
|
+
into the new directory.
|
|
466
|
+
|
|
467
|
+
* **gh_pages_version_var** is the name of the Javascript variable in the
|
|
468
|
+
`404.html` file that stores the latest version of this component's release.
|
|
469
|
+
You will generally not need to modify this unless the automatically-generated
|
|
470
|
+
variable name isn't unique for some reason.
|
|
471
|
+
|
|
472
|
+
See the [component configuration](#component-configuration) section for more
|
|
473
|
+
details.
|
|
474
|
+
|
|
475
|
+
### Special commit messages
|
|
476
|
+
|
|
477
|
+
Several special cases can be handled via commit tags that are defined by
|
|
478
|
+
Toys-Release. These conventional commit messages can appear in a commit message
|
|
479
|
+
and affect the behavior of that and other commits.
|
|
480
|
+
|
|
481
|
+
* **semver-change:** This tag forces a certain semver change to apply to this
|
|
482
|
+
commit even if other commit tags say otherwise. For example, if a commit
|
|
483
|
+
describes a new feature, but you want it released as a patch version bump
|
|
484
|
+
rather than a minor version bump, you can include `semver-change: patch` in
|
|
485
|
+
the commit message. The full commit message might read thus:
|
|
486
|
+
|
|
487
|
+
feat: Add a small button that doesn't do a lot
|
|
488
|
+
semver-change: patch
|
|
489
|
+
|
|
490
|
+
Valid values for semver-change are `patch`, `minor`, `major`, and `none`.
|
|
491
|
+
|
|
492
|
+
The semver-change tag affects only the commit it is part of. If multiple
|
|
493
|
+
commits are included in a release, other commits in the release might still
|
|
494
|
+
upgrade the version bump to minor or higher.
|
|
495
|
+
|
|
496
|
+
* **revert-commit:** This tag indicates that the commit reverts, and thus
|
|
497
|
+
nullifies the effect of, an earlier commit, thus removing any version bump
|
|
498
|
+
and any changelog entries that would otherwise have been generated. Use the
|
|
499
|
+
SHA of the earlier commit as the content of the tag. For example:
|
|
500
|
+
|
|
501
|
+
revert-commit: b10c6fb3363bd1335dcfbd671bdceae53cd55716
|
|
502
|
+
|
|
503
|
+
A commit can combine revert-commit with other conventional commit tags. It
|
|
504
|
+
can even include multiple revert-commit tags if the commit reverts more than
|
|
505
|
+
one previous commit.
|
|
272
506
|
|
|
273
507
|
### Running on the command line
|
|
274
508
|
|
|
275
|
-
(
|
|
509
|
+
The implementation of Toys-Release is done via Toys (i.e. command line) tools.
|
|
510
|
+
In most cases, you will use the GitHub Actions integration to manage your
|
|
511
|
+
releases, but you can also run the tools directly from the command line.
|
|
512
|
+
|
|
513
|
+
To do so, first make sure you have
|
|
514
|
+
[installed the release tool](#install-the-release-tool) as documented in the
|
|
515
|
+
main setup procedure. Then, the command line tools will be available as
|
|
516
|
+
subtools underneath `toys release`. For example, you could request a release
|
|
517
|
+
from the command line instead of a GitHub Action, by running the command
|
|
518
|
+
`toys release request`, and providing it the needed arguments and credentials.
|
|
519
|
+
|
|
520
|
+
As with all Toys-based tools, you can pass `--help` to any tool to get detailed
|
|
521
|
+
usage information. For example: `toys release request --help`. You can also run
|
|
522
|
+
`toys release --help` for a list of all the release-related tools.
|
|
523
|
+
|
|
524
|
+
The following are the available command line tools. You may recognize some of
|
|
525
|
+
these as tools you used during the [installation](#installation) procedure.
|
|
526
|
+
|
|
527
|
+
* **create-labels** Creates the GitHub labels used by the release system
|
|
528
|
+
|
|
529
|
+
* **gen-config** Generates an initial release configuration file
|
|
530
|
+
|
|
531
|
+
* **gen-gh-pages** Initializes the gh-pages branch for publishing documentation
|
|
532
|
+
|
|
533
|
+
* **gen-workflows** Generates the GitHub Actions workflows used by Toys-Release
|
|
534
|
+
|
|
535
|
+
* **perform** Runs the release pipeline from the command line. Assumes you have
|
|
536
|
+
already updated the version number and the changelog.
|
|
537
|
+
|
|
538
|
+
* **request** Analyzes the repository history and opens a release pull request
|
|
539
|
+
including any pending releases. This is the command line tool used by the
|
|
540
|
+
"Open release request" GitHub Action.
|
|
541
|
+
|
|
542
|
+
* **retry** Retries a failed release. This is the command line tool used by the
|
|
543
|
+
"Retry release" GitHub Action.
|
|
544
|
+
|
|
545
|
+
There are also internal (hidden) subtools called "_onclosed" and "_onpush".
|
|
546
|
+
These are the tools called by GitHub Actions automation in response to pull
|
|
547
|
+
request events, and you should generally not call them directly.
|
|
276
548
|
|
|
277
549
|
## The release pipeline
|
|
278
550
|
|
|
@@ -292,23 +564,241 @@ configuration reference documentation.
|
|
|
292
564
|
|
|
293
565
|
### Pipeline steps
|
|
294
566
|
|
|
295
|
-
|
|
567
|
+
A release pipeline is defined as an ordered series of **steps**. Each of these
|
|
568
|
+
steps may perform some task and/or exchange some data with other steps. For
|
|
569
|
+
example, a step might install a bundle, another might build a gem package, and
|
|
570
|
+
another might push a gem package built by a previous step to rubygems.org.
|
|
571
|
+
|
|
572
|
+
The behavior of a step is determined by the **type** of the step, and by
|
|
573
|
+
additional **configuration attributes** provided to the step. Each step also
|
|
574
|
+
has a unique **name** that lets you identify it and connect it to other steps.
|
|
575
|
+
|
|
576
|
+
When a pipeline is run, individual steps in the pipeline may or may not
|
|
577
|
+
actually execute, depending on whether they are needed. For example, the step
|
|
578
|
+
type that creates a GitHub release will always run if it is present in a
|
|
579
|
+
pipeline, but the step type that installs the bundle will normally run only if
|
|
580
|
+
another subsequent step *that will run* actually needs the bundle, and the step
|
|
581
|
+
type that builds the gem package will normally run only if a subsequent step
|
|
582
|
+
*that will run* actually uses the built package (e.g. to push it to RubyGems.)
|
|
583
|
+
The decision of whether or not a step will run depends on the step's
|
|
584
|
+
configuration, and the step dependencies configured into the pipeline.
|
|
585
|
+
|
|
586
|
+
We will cover, as an example, the [standard pipeline](#the-standard-pipeline)
|
|
587
|
+
for RubyGems releases below. First, however, we need to discuss how steps
|
|
588
|
+
depend on one another and pass data around.
|
|
296
589
|
|
|
297
590
|
### Inter-step communication and dependencies
|
|
298
591
|
|
|
299
|
-
|
|
592
|
+
When a step runs, the working directory is set to the **component directory**
|
|
593
|
+
in a *clean* checkout of the release SHA in the repository. Any changes it
|
|
594
|
+
makes to the repository working directory are *not* preserved for other steps;
|
|
595
|
+
instead, it must explicitly "output" any files it needs to make available, and
|
|
596
|
+
other steps must explicitly access those files as "inputs". This is sometimes
|
|
597
|
+
done by the step's code, but can also be specified in the step's configuration.
|
|
598
|
+
|
|
599
|
+
For example, a step that builds a gem package should "output" the package so
|
|
600
|
+
that it is available to other steps that want to publish it. This simply
|
|
601
|
+
involves copying the relevant files to a special directory known as the output
|
|
602
|
+
directory for that step (identified by step name). The standard **build_gem**
|
|
603
|
+
step type does this in code. Alternatively, if you write a custom step that
|
|
604
|
+
builds an artifact, you can specify, via the **outputs** configuration, the
|
|
605
|
+
artifacts that you want made available. (See the
|
|
606
|
+
[output config reference](#step-output-configuration) for details.)
|
|
607
|
+
|
|
608
|
+
Then, a step can use a built artifact previously output by another step by
|
|
609
|
+
copying it from the previous step's output directory. Again, this can be done
|
|
610
|
+
in code, as by the standard **release_gem** step type. You can also specify,
|
|
611
|
+
via the **inputs** configuration, artifacts to copy from another step's output
|
|
612
|
+
into your working directory. (For details, see the
|
|
613
|
+
[input config reference](#step-input-configuration).)
|
|
614
|
+
|
|
615
|
+
When a step specifies the **inputs** configuration, any steps so referenced are
|
|
616
|
+
also automatically tagged as *dependencies* of the step. If the pipeline
|
|
617
|
+
determines the step should be run, then its dependencies are also marked as to
|
|
618
|
+
be run.
|
|
619
|
+
|
|
620
|
+
#### Inter-step communication example
|
|
621
|
+
|
|
622
|
+
Consider the following simple, if contrived, pipeline:
|
|
623
|
+
|
|
624
|
+
```yaml
|
|
625
|
+
- name: create_file
|
|
626
|
+
type: command
|
|
627
|
+
command: ["touch", "my-file.txt"]
|
|
628
|
+
outputs:
|
|
629
|
+
- source_path: my-file.txt
|
|
630
|
+
- name: create_another_file
|
|
631
|
+
type: command
|
|
632
|
+
command: ["touch", "another-file.txt"]
|
|
633
|
+
outputs:
|
|
634
|
+
- source_path: another-file.txt
|
|
635
|
+
- name: show_file
|
|
636
|
+
type: command
|
|
637
|
+
command: ["cat", "my-file.txt"]
|
|
638
|
+
inputs:
|
|
639
|
+
- name: create_file
|
|
640
|
+
source_path: my-file.txt
|
|
641
|
+
run: true
|
|
642
|
+
```
|
|
300
643
|
|
|
301
|
-
|
|
644
|
+
This pipeline includes three steps. After each step, the git repository gets
|
|
645
|
+
reset, so any files created by the step are not initially available to
|
|
646
|
+
subsequent steps unless the step explicitly accesses them via inputs. Also note
|
|
647
|
+
that all three steps are of type "command", which do not run by default unless
|
|
648
|
+
something else causes them to run.
|
|
302
649
|
|
|
303
|
-
|
|
650
|
+
Let's consider these steps starting with the last one.
|
|
304
651
|
|
|
305
|
-
|
|
652
|
+
The third step, named `show_file`, looks for a file `my-file.txt` in the
|
|
653
|
+
*first* step's outputs, copies it into its working directory, and prints its
|
|
654
|
+
contents to the logs. It includes the `run: true` configuration which forces it
|
|
655
|
+
to run.
|
|
306
656
|
|
|
307
|
-
|
|
657
|
+
Because the third step, `show_file`, copies an input from the first step,
|
|
658
|
+
`create_file`, the latter is a dependency of the former. And since the
|
|
659
|
+
`show_file` is forced to run, then `create_file` will also run. This step will
|
|
660
|
+
run first, because it is first in the list of steps, and it will create a file
|
|
661
|
+
and copy it to its outputs so the `show_file` can access it.
|
|
308
662
|
|
|
309
|
-
|
|
663
|
+
The second step, `create_another_file`, would create another file and copy it
|
|
664
|
+
to its outputs. However, it neither is forced to run via `run: true` nor is
|
|
665
|
+
listed as a dependency of any other step that will run. Therefore, the second
|
|
666
|
+
step never runs at all.
|
|
310
667
|
|
|
311
|
-
|
|
668
|
+
### The standard pipeline
|
|
669
|
+
|
|
670
|
+
The default release pipeline illustrates the above features of steps. It
|
|
671
|
+
includes the following steps:
|
|
672
|
+
|
|
673
|
+
* **bundle**: Installs the bundle, and copies the `Gemfile.lock` to its output
|
|
674
|
+
directory. This step runs because the later step **build_yard** declares it
|
|
675
|
+
as a dependency and accesses the `Gemfile.lock`.
|
|
676
|
+
* **build_gem**: Builds the gem package, and copies the package file to its
|
|
677
|
+
output directory. This step runs because the later step **release_gem**
|
|
678
|
+
declares it as a dependency and accesses the built package.
|
|
679
|
+
* **build_yard**: Builds the Yardoc documentation. By default, this step uses
|
|
680
|
+
the `yard` gem from the bundle, and thus depends on the earlier **bundle**
|
|
681
|
+
step. It copies the `Gemfile.lock` output by the earlier step. After building
|
|
682
|
+
the documentation into the `doc` directory, it copies that directory to its
|
|
683
|
+
output directory. This step runs *if* the later step **push_gh_pages**, which
|
|
684
|
+
lists it as a dependency, runs.
|
|
685
|
+
* **release_github**: Pushes a release tag to GitHub and creates a GitHub
|
|
686
|
+
release. This step always runs and has no dependencies.
|
|
687
|
+
* **release_gem**: Pushes the built gem package to rubygems.org. This step
|
|
688
|
+
lists the earlier **build_gem** step as a dependency, and copies the built
|
|
689
|
+
gem package from that step's output.
|
|
690
|
+
* **push_gh_pages**: Pushes the built documentation to the `gh-pages` branch so
|
|
691
|
+
it shows up on the repository's GitHub Pages site. This step runs only if the
|
|
692
|
+
repository actually has a `gh-pages` branch and the release configuration
|
|
693
|
+
specifies that it should be pushed to. If this step does run, it lists the
|
|
694
|
+
earlier **build_yard** step as a dependency, and copies the built
|
|
695
|
+
documentation from that step's output.
|
|
696
|
+
|
|
697
|
+
Ultimately, this pipeline will create a GitHub release, push a RubyGems
|
|
698
|
+
package, and optionally push documentation.
|
|
699
|
+
|
|
700
|
+
### Modifying the pipeline
|
|
701
|
+
|
|
702
|
+
If your releases have different requirements, you can modify the release
|
|
703
|
+
pipeline, by inserting steps, by modifying existing steps, or by replacing the
|
|
704
|
+
entire pipeline with a new pipeline. These modifications can be made globally
|
|
705
|
+
for all releases in a repository, or specifically for individual releasable
|
|
706
|
+
components, by adding configuration at the top level of the configuration (see
|
|
707
|
+
the [top level configuration reference](#top-level-configuration)) or
|
|
708
|
+
underneath a particular component's configuration (see the
|
|
709
|
+
[component configuration reference](#component-configuration)).
|
|
710
|
+
|
|
711
|
+
* To insert new steps, at the beginning or end of the pipeline, or before or
|
|
712
|
+
after specific named steps, use the **append_steps** and **prepend_steps**
|
|
713
|
+
configurations.
|
|
714
|
+
* To modify existing steps, use the **modify_steps** configuration. See the
|
|
715
|
+
reference on [build step modification](#build-step-modification).
|
|
716
|
+
* There is no specific way to delete an existing step. This is because a step
|
|
717
|
+
might be referenced by other steps. To ensure a step does not run, you can
|
|
718
|
+
modify it to change its type to `noop` (which has no behavior and does not
|
|
719
|
+
run by default) and ensure that no step depends on it.
|
|
720
|
+
* If your changes are more complex than can reasonably be expressed by
|
|
721
|
+
modifying the default pipeline, you can replace the pipeline completely using
|
|
722
|
+
the **steps** configuration.
|
|
723
|
+
|
|
724
|
+
#### Pipeline modification example
|
|
725
|
+
|
|
726
|
+
The `toys` gem itself has a customized release pipeline. This pipeline includes
|
|
727
|
+
a step that merges key classes from `toys-core`, such as DSL classes, into the
|
|
728
|
+
documentation for the `toys` gem.
|
|
729
|
+
|
|
730
|
+
The merging is actually performed by a toys tool called `copy-core-docs`
|
|
731
|
+
defined in the directory for the `toys` gem. The implementation itself isn't
|
|
732
|
+
important; what's important is that we want this merging to be part of the
|
|
733
|
+
release process.
|
|
734
|
+
|
|
735
|
+
The `releases.yml` for the toys repository includes this configuration for the
|
|
736
|
+
`toys` gem:
|
|
737
|
+
|
|
738
|
+
```yaml
|
|
739
|
+
components:
|
|
740
|
+
- name: toys
|
|
741
|
+
prepend_steps:
|
|
742
|
+
- name: copy_core_docs
|
|
743
|
+
type: tool
|
|
744
|
+
tool: [copy-core-docs]
|
|
745
|
+
outputs: [core-docs]
|
|
746
|
+
modify_steps:
|
|
747
|
+
- name: build_yard
|
|
748
|
+
inputs: [copy_core_docs]
|
|
749
|
+
- name: build_gem
|
|
750
|
+
inputs: [copy_core_docs]
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
Let's unpack what this is doing.
|
|
754
|
+
|
|
755
|
+
First, we note that we are not replacing the default pipeline completely; we
|
|
756
|
+
are only modifying it *for this one gem*. The other gems (`toys-core` and
|
|
757
|
+
`toys-release`) continue to use the default pipeline unmodified.
|
|
758
|
+
|
|
759
|
+
For the `toys` gem, then, we prepend one new step at the beginning of the
|
|
760
|
+
pipeline. The step is named `copy_core_docs`, and it runs the toys tool that
|
|
761
|
+
copies files (with some modifications to simplify them and make them suitable
|
|
762
|
+
for just documentation) from `toys-core` into the `toys` directory under the
|
|
763
|
+
`core-docs` subdirectory. This directory is not part of the include path, so
|
|
764
|
+
these files are not in the require path and do not interfere with the
|
|
765
|
+
functionality of the library. However, they are in the `.yardopts` file and are
|
|
766
|
+
used when documentation is built. We then copy this new directory to the
|
|
767
|
+
output for the `copy_core_docs` step, to preserve it for future steps.
|
|
768
|
+
|
|
769
|
+
Next, we modify the `build_yard` step to load the `copy_core_docs` output. This
|
|
770
|
+
brings those files back into our working directory when the Yardocs are built.
|
|
771
|
+
It also adds the `copy_core_docs` step to the dependencies of `build_yard` to
|
|
772
|
+
ensure it gets executed.
|
|
773
|
+
|
|
774
|
+
We also modify the `build_gem` step to load the `copy_core_docs` output. This
|
|
775
|
+
ensures that the files are also present when the gem is built, so that services
|
|
776
|
+
like rubydoc.info will have them available when they build the documentation.
|
|
777
|
+
Again, this also adds `copy_core_docs` to the dependencies of `build_gem`. As a
|
|
778
|
+
dependency of both `build_gem` and `build_yard`, this ensures that our new step
|
|
779
|
+
will indeed get executed. (It does not execute twice; Toys-Release ensures each
|
|
780
|
+
step is executed at most once, even if it is listed multiple times as a
|
|
781
|
+
dependency.)
|
|
782
|
+
|
|
783
|
+
#### Useful types for custom steps
|
|
784
|
+
|
|
785
|
+
The **command** and **tool** step types are both very useful when creating
|
|
786
|
+
custom steps. We've seen in the [example above](#pipeline-modification-example)
|
|
787
|
+
how a step of type **tool** is used in the customized release process for the
|
|
788
|
+
`toys` gem itself. The **command** type is similar; it executes a Unix command
|
|
789
|
+
rather than a Toys tool. These two types are very useful for performing
|
|
790
|
+
arbitrary behavior during a release.
|
|
791
|
+
|
|
792
|
+
Another step type that is occasionally useful is **noop**. This type has no
|
|
793
|
+
behavior; it doesn't *do* anything, but you can configure it with inputs and
|
|
794
|
+
outputs. This can be useful for consolidating data output by other steps. You
|
|
795
|
+
can, for example, configure a **noop** with multiple **inputs** from other
|
|
796
|
+
steps, configuring each input to copy to the noop's *output*. Now, all the
|
|
797
|
+
files from potentially multiple inputs are combined and can be referenced
|
|
798
|
+
conveniently via a single step's output.
|
|
799
|
+
|
|
800
|
+
See the reference below on [build step types](#build-step-types) for detailed
|
|
801
|
+
information on these and other step types and their configurations.
|
|
312
802
|
|
|
313
803
|
## Configuration reference
|
|
314
804
|
|
|
@@ -448,6 +938,9 @@ required. The rest are optional.
|
|
|
448
938
|
- name: push_gh_pages
|
|
449
939
|
source: build_yard
|
|
450
940
|
|
|
941
|
+
See the earlier section on [the standard pipeline](#the-standard-pipeline)
|
|
942
|
+
for a detailed description of the behavior of this default pipeline.
|
|
943
|
+
|
|
451
944
|
### Commit tag configuration
|
|
452
945
|
|
|
453
946
|
A commit tag configuration specifies how the release system should handle a
|
|
@@ -613,10 +1106,10 @@ the section on [the release pipeline](#the-release-pipeline) above.
|
|
|
613
1106
|
|
|
614
1107
|
#### Step input configuration
|
|
615
1108
|
|
|
616
|
-
A step input represents a dependency on another step: if this step
|
|
617
|
-
other step will also be run. It also describes files
|
|
618
|
-
the dependent step's output and made available to
|
|
619
|
-
configuration is a dictionary
|
|
1109
|
+
A step input represents a dependency on another step: if this (depending) step
|
|
1110
|
+
is run, that other (dependent) step will also be run. It also describes files
|
|
1111
|
+
that should be copied from the dependent step's output and made available to
|
|
1112
|
+
the depending step. This configuration is a dictionary with the following keys:
|
|
620
1113
|
|
|
621
1114
|
* **collisions**: *string* (optional) --
|
|
622
1115
|
A symbolic value indicating what to do if a collision occurs between incoming
|
|
@@ -698,16 +1191,18 @@ any additional configuration keys supported by each.
|
|
|
698
1191
|
This step builds the gem described by the properly named gemspec file for
|
|
699
1192
|
this component. The built package file is copied to this step's output. Other
|
|
700
1193
|
steps (such as **release_gem**) can declare it as an input to get access to
|
|
701
|
-
the built package. This step does not run unless it is
|
|
702
|
-
dependency or unless it is requested explicitly
|
|
1194
|
+
the built package. This step does not run unless it is declared as an input
|
|
1195
|
+
dependency, or unless it is requested explicitly using the **run**
|
|
1196
|
+
configuration.
|
|
703
1197
|
|
|
704
1198
|
* **build_yard** -- A step that builds Yardocs.
|
|
705
1199
|
|
|
706
1200
|
This step builds documentation using [YARD](https://yardoc.org). The built
|
|
707
1201
|
documentation is copied to this step's output in the directory `doc/`. Other
|
|
708
1202
|
steps (such as **push_gh_pages**) can declare it as an input to get access to
|
|
709
|
-
the built documentation. This step does not run unless it is
|
|
710
|
-
dependency or unless it is requested explicitly
|
|
1203
|
+
the built documentation. This step does not run unless it is declared as an
|
|
1204
|
+
input dependency, or unless it is requested explicitly using the **run**
|
|
1205
|
+
configuration.
|
|
711
1206
|
|
|
712
1207
|
This step supports the following additional configuration keys:
|
|
713
1208
|
|
|
@@ -727,8 +1222,8 @@ any additional configuration keys supported by each.
|
|
|
727
1222
|
|
|
728
1223
|
This step copies the resulting `Gemfile.lock` to its output. Other steps can
|
|
729
1224
|
declare it as an input to get access to the `Gemfile.lock`. This step
|
|
730
|
-
does not run unless it is
|
|
731
|
-
requested explicitly.
|
|
1225
|
+
does not run unless it is declared as an input dependency, or unless it is
|
|
1226
|
+
requested explicitly using the **run** configuration.
|
|
732
1227
|
|
|
733
1228
|
This step supports the following additional configuration keys:
|
|
734
1229
|
|
|
@@ -752,14 +1247,14 @@ any additional configuration keys supported by each.
|
|
|
752
1247
|
If *false* (the default), the pipeline aborts.
|
|
753
1248
|
|
|
754
1249
|
This step does not run unless it is requested explicitly using the **run**
|
|
755
|
-
configuration or it is declared as a dependency.
|
|
1250
|
+
configuration, or it is declared as a dependency.
|
|
756
1251
|
|
|
757
1252
|
* **noop** -- A no-op step that does nothing. This type is usually configured
|
|
758
1253
|
with inputs and outputs and is used to collect or consolidate data from other
|
|
759
1254
|
steps.
|
|
760
1255
|
|
|
761
1256
|
This step does not run unless it is requested explicitly using the **run**
|
|
762
|
-
configuration or it is declared as a dependency.
|
|
1257
|
+
configuration, or it is declared as a dependency.
|
|
763
1258
|
|
|
764
1259
|
* **push_gh_pages** -- A step that pushes documentation to the gh-pages branch.
|
|
765
1260
|
|
|
@@ -808,7 +1303,7 @@ any additional configuration keys supported by each.
|
|
|
808
1303
|
The tool to run
|
|
809
1304
|
|
|
810
1305
|
This step does not run unless it is requested explicitly using the **run**
|
|
811
|
-
configuration or it is declared as a dependency.
|
|
1306
|
+
configuration, or it is declared as a dependency.
|
|
812
1307
|
|
|
813
1308
|
#### Build step modification
|
|
814
1309
|
|
data/lib/toys/release/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: toys-release
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Azuma
|
|
@@ -81,10 +81,10 @@ homepage: https://github.com/dazuma/toys
|
|
|
81
81
|
licenses:
|
|
82
82
|
- MIT
|
|
83
83
|
metadata:
|
|
84
|
-
changelog_uri: https://dazuma.github.io/toys/gems/toys-release/v0.3.
|
|
84
|
+
changelog_uri: https://dazuma.github.io/toys/gems/toys-release/v0.3.1/file.CHANGELOG.html
|
|
85
85
|
source_code_uri: https://github.com/dazuma/toys/tree/main/toys-release
|
|
86
86
|
bug_tracker_uri: https://github.com/dazuma/toys/issues
|
|
87
|
-
documentation_uri: https://dazuma.github.io/toys/gems/toys-release/v0.3.
|
|
87
|
+
documentation_uri: https://dazuma.github.io/toys/gems/toys-release/v0.3.1
|
|
88
88
|
rdoc_options: []
|
|
89
89
|
require_paths:
|
|
90
90
|
- lib
|