@inditextech/docouture-cli 0.1.0-SNAPSHOT.68.1 → 0.1.0-SNAPSHOT.71.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.
- package/build/bin.js +54 -4
- package/build/commands/branch-model.js +211 -0
- package/build/commands/completion.js +1 -0
- package/build/commands/doctor.js +11 -1
- package/build/commands/new.js +137 -8
- package/build/commands/upgrade.js +20 -0
- package/build/lib/branch-detect.js +87 -0
- package/build/lib/copy-template.js +4 -0
- package/build/lib/dev-server.js +17 -3
- package/build/lib/doctor-checks.js +40 -0
- package/build/lib/playbook-yml.js +51 -0
- package/build/templates/starter/antora-playbook.local.yml +12 -10
- package/build/templates/starter/antora-playbook.versioned.yml +10 -9
- package/build/templates/starter/antora-playbook.yml +10 -8
- package/build/templates/starter/package.json +1 -0
- package/build/templates/starter/src/antora.yml +2 -2
- package/build/templates/starter/src/modules/main/pages/components.adoc +2 -2
- package/build/templates/workflows/docouture-kroki-cache-warm.yml +31 -17
- package/build/templates/workflows/docouture-publish-prerelease.yml +22 -17
- package/build/templates/workflows/docouture-publish.yml +1 -1
- package/build/templates/workflows/docouture-release-preview.yml +3 -2
- package/build/templates/workflows/docouture-release.yml +70 -57
- package/package.json +1 -1
|
@@ -6,7 +6,7 @@ name: docouture-release
|
|
|
6
6
|
# tags permanently say `tags: ['docs/v*']` under versioned (Full History) or
|
|
7
7
|
# `tags: ['docs/stable']` under standalone (Stable + Prerelease) from the moment a
|
|
8
8
|
# site opts into either — see the `Detect mode` step below. `docs/antora.yml`
|
|
9
|
-
# on
|
|
9
|
+
# on the release branch is identical for both modes (`version: prerelease`,
|
|
10
10
|
# `prerelease: true`) and is never read for this. Adopting a mode in the
|
|
11
11
|
# first place (setting antora-playbook.yml's content.sources[] tags/branches)
|
|
12
12
|
# is still a manual, one-time edit; this workflow only handles cutting
|
|
@@ -14,8 +14,11 @@ name: docouture-release
|
|
|
14
14
|
#
|
|
15
15
|
# Prerequisite, done once, not by this workflow: this site's own
|
|
16
16
|
# antora-playbook.yml content.sources[] must already match
|
|
17
|
-
# `branches: [
|
|
18
|
-
# `tags: ['docs/stable']` (standalone)
|
|
17
|
+
# `branches: [__DOCOUTURE_PRERELEASE_BRANCH__]` + `tags: ['docs/v*']` (versioned) or
|
|
18
|
+
# `branches: [__DOCOUTURE_PRERELEASE_BRANCH__]` + `tags: ['docs/stable']` (standalone) —
|
|
19
|
+
# see the guides-branching-model guide for what the prerelease/release
|
|
20
|
+
# branch roles mean (trunk-based: both the same branch; git-flow: two
|
|
21
|
+
# independently-named branches, e.g. `develop`/`main`).
|
|
19
22
|
#
|
|
20
23
|
# Two ways to run this, both deliberate acts rather than a side effect of an
|
|
21
24
|
# ordinary push:
|
|
@@ -23,7 +26,8 @@ name: docouture-release
|
|
|
23
26
|
# 1. workflow_dispatch — a person runs it by hand and supplies `version`
|
|
24
27
|
# (versioned) or leaves it as the default (standalone).
|
|
25
28
|
# 2. Automatically, when a pull request carrying the `docs/release` label
|
|
26
|
-
# is merged into a branch matching
|
|
29
|
+
# is merged into a branch matching the release branch (see the
|
|
30
|
+
# guides-branching-model guide). This path has no input to
|
|
27
31
|
# type a version into: standalone doesn't need one (always `docs/stable`);
|
|
28
32
|
# versioned reads it from `docs/.release-version`, a plain-text file
|
|
29
33
|
# the PR itself commits with the target version — reviewed as part of
|
|
@@ -34,11 +38,11 @@ name: docouture-release
|
|
|
34
38
|
# always force-recreates a tag that already exists, both modes, no separate
|
|
35
39
|
# flag or label needed. `docs/.release-version` itself is never cleared by
|
|
36
40
|
# hand: after every successful versioned release that is NOT a republish,
|
|
37
|
-
# this workflow bumps it forward to the next patch version on
|
|
38
|
-
# "Bump release descriptor" below), so the file always holds a
|
|
39
|
-
# target rather than going stale. A republish (the target tag
|
|
40
|
-
# existed) skips that bump, since `docs/.release-version` already
|
|
41
|
-
# whatever was planned to come after it.
|
|
41
|
+
# this workflow bumps it forward to the next patch version on the release
|
|
42
|
+
# branch (see "Bump release descriptor" below), so the file always holds a
|
|
43
|
+
# sane next target rather than going stale. A republish (the target tag
|
|
44
|
+
# already existed) skips that bump, since `docs/.release-version` already
|
|
45
|
+
# holds whatever was planned to come after it.
|
|
42
46
|
on:
|
|
43
47
|
workflow_dispatch:
|
|
44
48
|
inputs:
|
|
@@ -52,7 +56,7 @@ on:
|
|
|
52
56
|
default: 'stable'
|
|
53
57
|
pull_request:
|
|
54
58
|
types: [closed]
|
|
55
|
-
branches: ['
|
|
59
|
+
branches: ['__DOCOUTURE_RELEASE_BRANCH__*']
|
|
56
60
|
|
|
57
61
|
permissions:
|
|
58
62
|
contents: write
|
|
@@ -79,24 +83,25 @@ jobs:
|
|
|
79
83
|
working-directory: docs
|
|
80
84
|
# workflow_dispatch always proceeds (it's already an explicit, deliberate
|
|
81
85
|
# act). The pull_request trigger fires on every close of a PR targeting
|
|
82
|
-
#
|
|
83
|
-
# label — so it only proceeds when both are true:
|
|
84
|
-
# carrying `docs/release`. Anything else is a
|
|
86
|
+
# the release branch — including ones that were closed unmerged, or
|
|
87
|
+
# merged without the label — so it only proceeds when both are true:
|
|
88
|
+
# actually merged, and carrying `docs/release`. Anything else is a
|
|
89
|
+
# no-op run, not an error.
|
|
85
90
|
if: >-
|
|
86
91
|
github.event_name == 'workflow_dispatch' ||
|
|
87
92
|
(github.event.pull_request.merged == true &&
|
|
88
93
|
contains(github.event.pull_request.labels.*.name, 'docs/release'))
|
|
89
94
|
steps:
|
|
90
|
-
- name: Require
|
|
95
|
+
- name: Require release branch
|
|
91
96
|
# Only meaningful for a manual dispatch: someone could run this
|
|
92
|
-
# workflow with a
|
|
93
|
-
# The pull_request trigger can't have this problem — the
|
|
94
|
-
# filter above already restricted it to
|
|
95
|
-
# and by the time a `closed`+`merged`
|
|
96
|
-
# reflects the merge.
|
|
97
|
-
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/
|
|
97
|
+
# workflow with a different branch selected in the "Run workflow"
|
|
98
|
+
# UI. The pull_request trigger can't have this problem — the
|
|
99
|
+
# `branches:` filter above already restricted it to the release
|
|
100
|
+
# branch before the job started, and by the time a `closed`+`merged`
|
|
101
|
+
# event fires, that branch already reflects the merge.
|
|
102
|
+
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/__DOCOUTURE_RELEASE_BRANCH__'
|
|
98
103
|
run: |
|
|
99
|
-
echo "::error::docouture-release must run against
|
|
104
|
+
echo "::error::docouture-release must run against __DOCOUTURE_RELEASE_BRANCH__ (got ${{ github.ref }})"
|
|
100
105
|
exit 1
|
|
101
106
|
|
|
102
107
|
- name: Checkout
|
|
@@ -105,10 +110,11 @@ jobs:
|
|
|
105
110
|
# Standalone moves an existing `docs/stable` tag, which has to already
|
|
106
111
|
# be reachable in history to be force-moved. Versioned only ever
|
|
107
112
|
# creates a brand-new tag on a brand-new commit and doesn't
|
|
108
|
-
# strictly need this, but the detect step below needs
|
|
109
|
-
# either way, and full history is harmless for that
|
|
113
|
+
# strictly need this, but the detect step below needs the release
|
|
114
|
+
# branch's tip either way, and full history is harmless for that
|
|
115
|
+
# case.
|
|
110
116
|
fetch-depth: 0
|
|
111
|
-
ref:
|
|
117
|
+
ref: __DOCOUTURE_RELEASE_BRANCH__
|
|
112
118
|
# Don't persist the ambient GITHUB_TOKEN's credentials — it isn't
|
|
113
119
|
# on this repo's branch-ruleset bypass list, and a local credential
|
|
114
120
|
# from actions/checkout would otherwise win over the app token's
|
|
@@ -180,7 +186,8 @@ jobs:
|
|
|
180
186
|
# yet, so the real playbook's tag-based content source can't see it —
|
|
181
187
|
# it would just rebuild whatever was already released, not what's
|
|
182
188
|
# about to ship. The local playbook validates exactly the content on
|
|
183
|
-
#
|
|
189
|
+
# the release branch right now, which is what the new version will
|
|
190
|
+
# actually be.
|
|
184
191
|
- name: Build docs
|
|
185
192
|
run: npx antora --fetch antora-playbook.local.yml
|
|
186
193
|
|
|
@@ -199,12 +206,13 @@ jobs:
|
|
|
199
206
|
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
200
207
|
|
|
201
208
|
# Mints an installation token for a GitHub App that's on this repo's
|
|
202
|
-
# branch-ruleset bypass list, if
|
|
203
|
-
# one (branch rulesets requiring PRs / status checks) —
|
|
204
|
-
# in InditexTech/docouture. `Push release tag` and
|
|
205
|
-
# descriptor` below both push straight to a branch/ref,
|
|
206
|
-
# GITHUB_TOKEN identity is never on a ruleset's own
|
|
207
|
-
# those pushes are rejected (GH013) on a protected
|
|
209
|
+
# branch-ruleset bypass list, if the release branch/`gh-pages` are
|
|
210
|
+
# protected by one (branch rulesets requiring PRs / status checks) —
|
|
211
|
+
# see issue #157 in InditexTech/docouture. `Push release tag` and
|
|
212
|
+
# `Bump release descriptor` below both push straight to a branch/ref,
|
|
213
|
+
# and the plain GITHUB_TOKEN identity is never on a ruleset's own
|
|
214
|
+
# bypass list, so those pushes are rejected (GH013) on a protected
|
|
215
|
+
# repo without this.
|
|
208
216
|
# `APP_CLIENT_ID` (a variable) and `APP_PRIVATE_KEY` (a secret) are
|
|
209
217
|
# organization-level in InditexTech — set both at the org or repo
|
|
210
218
|
# level for whichever GitHub App is bypass-listed on this site's rules.
|
|
@@ -298,14 +306,18 @@ jobs:
|
|
|
298
306
|
echo "::warning::Standalone mode always releases to the 'stable' tag — ignoring provided version '${VERSION}'."
|
|
299
307
|
fi
|
|
300
308
|
|
|
301
|
-
#
|
|
302
|
-
# says version: prerelease (both modes
|
|
303
|
-
#
|
|
304
|
-
#
|
|
305
|
-
#
|
|
306
|
-
#
|
|
307
|
-
#
|
|
308
|
-
#
|
|
309
|
+
# The release branch's own docs/antora.yml is never touched here — it
|
|
310
|
+
# permanently says version: prerelease (both modes, trunk-based only
|
|
311
|
+
# — see the guides-branching-model guide for why this steady-state
|
|
312
|
+
# value stops being meaningful once the release branch is a distinct,
|
|
313
|
+
# git-flow branch: nothing reads it back in that case either way).
|
|
314
|
+
# This step patches a COMMIT, not the release branch itself:
|
|
315
|
+
# `docouture version <value>` edits the working tree, that edit is
|
|
316
|
+
# committed on top of the release branch's current tip, and then the
|
|
317
|
+
# release branch is reset back to that same tip immediately after —
|
|
318
|
+
# so the commit's only route into the repository's reachable history
|
|
319
|
+
# is whichever tag points at it next (pushed in the following step).
|
|
320
|
+
# It is deliberately never pushed as part of the release branch.
|
|
309
321
|
- name: Cut release
|
|
310
322
|
id: cut
|
|
311
323
|
env:
|
|
@@ -327,9 +339,9 @@ jobs:
|
|
|
327
339
|
git commit -m "chore: docs release ${tag}"
|
|
328
340
|
sha=$(git rev-parse HEAD)
|
|
329
341
|
|
|
330
|
-
# Detach
|
|
331
|
-
# existing (git doesn't garbage-collect same-run
|
|
332
|
-
# just no longer what any local branch points at.
|
|
342
|
+
# Detach the release branch back to its real tip. The commit just
|
|
343
|
+
# made keeps existing (git doesn't garbage-collect same-run
|
|
344
|
+
# objects), it's just no longer what any local branch points at.
|
|
333
345
|
git reset --hard "$base"
|
|
334
346
|
|
|
335
347
|
echo "sha=${sha}" >> "$GITHUB_OUTPUT"
|
|
@@ -397,9 +409,9 @@ jobs:
|
|
|
397
409
|
# workspace's own npm packages: let `npm version` do the semver
|
|
398
410
|
# arithmetic against a throwaway package.json instead of hand-rolling
|
|
399
411
|
# it, then read the result back out. This is a real commit directly on
|
|
400
|
-
#
|
|
401
|
-
# advances
|
|
402
|
-
# republish: that run's target version was already superseded by
|
|
412
|
+
# the release branch (unlike "Cut release" above, which deliberately
|
|
413
|
+
# never advances it) — it's just bookkeeping, not a release. Skipped
|
|
414
|
+
# on a republish: that run's target version was already superseded by
|
|
403
415
|
# whatever docs/.release-version currently holds, so bumping forward
|
|
404
416
|
# from it would clobber that already-planned next target instead of
|
|
405
417
|
# protecting it.
|
|
@@ -416,24 +428,25 @@ jobs:
|
|
|
416
428
|
echo "${next}" > .release-version
|
|
417
429
|
git add .release-version
|
|
418
430
|
git commit -m "chore: bump docs/.release-version to ${next}"
|
|
419
|
-
git push origin
|
|
431
|
+
git push origin __DOCOUTURE_RELEASE_BRANCH__
|
|
420
432
|
|
|
421
433
|
echo "docs/.release-version: ${VERSION} → ${next}"
|
|
422
434
|
|
|
423
435
|
# Rebuild/deploy: called directly here, as a reusable job, rather than
|
|
424
436
|
# relying on docouture-publish.yml's own trigger reacting to the pushes
|
|
425
437
|
# above — a plain `on: push` there previously had two problems: (1) it
|
|
426
|
-
# matched both the tag push above AND
|
|
427
|
-
# unrelated commit to
|
|
428
|
-
# commit, previously pushed to
|
|
429
|
-
# with nothing to do with a release, and (2)
|
|
430
|
-
# and its
|
|
431
|
-
# twice for one release with no
|
|
432
|
-
# direct `needs:` job dependency
|
|
433
|
-
# only ever runs once, only after
|
|
434
|
-
#
|
|
435
|
-
# already false for a no-op
|
|
436
|
-
#
|
|
438
|
+
# matched both the tag push above AND the release branch's ordinary
|
|
439
|
+
# pushes, so an unrelated commit to it (or this job's own
|
|
440
|
+
# release-version bump commit, previously pushed to it directly)
|
|
441
|
+
# could kick off a publish with nothing to do with a release, and (2)
|
|
442
|
+
# both this job's tag push and its release-branch push could each
|
|
443
|
+
# independently match, firing publish twice for one release with no
|
|
444
|
+
# ordering guarantee between them. A direct `needs:` job dependency
|
|
445
|
+
# below has neither problem: publish only ever runs once, only after
|
|
446
|
+
# this job finishes, and only when it actually cut something
|
|
447
|
+
# (`needs.release.result == 'success'` is already false for a no-op
|
|
448
|
+
# run — see this job's own `if:` above, which makes a run that
|
|
449
|
+
# doesn't match skip rather than succeed).
|
|
437
450
|
publish:
|
|
438
451
|
name: Publish
|
|
439
452
|
needs: release
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inditextech/docouture-cli",
|
|
3
|
-
"version": "0.1.0-SNAPSHOT.
|
|
3
|
+
"version": "0.1.0-SNAPSHOT.71.1",
|
|
4
4
|
"description": "Command-line tool for docouture documentation sites: scaffold a new site and set its Antora version outside the monorepo",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|