@inditextech/docouture-cli 0.1.0-SNAPSHOT.40.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 +321 -0
- package/build/commands/build.js +22 -0
- package/build/commands/completion.js +69 -0
- package/build/commands/dev.js +67 -0
- package/build/commands/doctor.js +156 -0
- package/build/commands/eject.js +71 -0
- package/build/commands/new.js +512 -0
- package/build/commands/publish.js +111 -0
- package/build/commands/teardown.js +66 -0
- package/build/commands/upgrade.js +156 -0
- package/build/commands/version.js +60 -0
- package/build/lib/agents-md.js +67 -0
- package/build/lib/antora-log.js +36 -0
- package/build/lib/antora-yml.js +47 -0
- package/build/lib/args.js +26 -0
- package/build/lib/cli-context.js +17 -0
- package/build/lib/cli-info.js +20 -0
- package/build/lib/config-resolver.js +23 -0
- package/build/lib/copy-template.js +162 -0
- package/build/lib/debug-log.js +21 -0
- package/build/lib/detect-package-manager.js +79 -0
- package/build/lib/dev-server.js +337 -0
- package/build/lib/doctor-checks.js +240 -0
- package/build/lib/global-flags.js +31 -0
- package/build/lib/kroki-compose.js +54 -0
- package/build/lib/playbook-yml.js +90 -0
- package/build/lib/repo-root.js +21 -0
- package/build/lib/run-script.js +50 -0
- package/build/lib/theme.js +51 -0
- package/build/templates/agent-support/.claude/skills/docs-internals/SKILL.md +53 -0
- package/build/templates/agent-support/.claude/skills/docs-internals/reference/antora-extensions.md +54 -0
- package/build/templates/agent-support/.claude/skills/docs-internals/reference/naming.md +41 -0
- package/build/templates/agent-support/.claude/skills/docs-internals/reference/page-patterns.md +238 -0
- package/build/templates/agent-support/.claude/skills/docs-versioning.versioned/SKILL.md +37 -0
- package/build/templates/agent-support/.claude/skills/docs-versioning.versioned/reference/releasing.md +106 -0
- package/build/templates/agent-support/.claude/skills/documenting-your-repo/SKILL.md +55 -0
- package/build/templates/agent-support/.claude/skills/documenting-your-repo/reference/content-sourcing.md +55 -0
- package/build/templates/agent-support/.claude/skills/documenting-your-repo/reference/maintenance-loop.md +68 -0
- package/build/templates/agent-support/.claude/skills/documenting-your-repo/reference/structure-planning.md +102 -0
- package/build/templates/agent-support/.claude/skills/writing-docs-pages/SKILL.md +112 -0
- package/build/templates/agent-support/.claude/skills/writing-docs-pages/reference/docouture-blocks.md +170 -0
- package/build/templates/agent-support/.claude/skills/writing-docs-pages/reference/language-basics.md +402 -0
- package/build/templates/agent-support/.opencode/skills/docs-internals/SKILL.md +53 -0
- package/build/templates/agent-support/.opencode/skills/docs-internals/reference/antora-extensions.md +54 -0
- package/build/templates/agent-support/.opencode/skills/docs-internals/reference/naming.md +41 -0
- package/build/templates/agent-support/.opencode/skills/docs-internals/reference/page-patterns.md +238 -0
- package/build/templates/agent-support/.opencode/skills/docs-versioning.versioned/SKILL.md +37 -0
- package/build/templates/agent-support/.opencode/skills/docs-versioning.versioned/reference/releasing.md +106 -0
- package/build/templates/agent-support/.opencode/skills/documenting-your-repo/SKILL.md +55 -0
- package/build/templates/agent-support/.opencode/skills/documenting-your-repo/reference/content-sourcing.md +55 -0
- package/build/templates/agent-support/.opencode/skills/documenting-your-repo/reference/maintenance-loop.md +68 -0
- package/build/templates/agent-support/.opencode/skills/documenting-your-repo/reference/structure-planning.md +102 -0
- package/build/templates/agent-support/.opencode/skills/writing-docs-pages/SKILL.md +112 -0
- package/build/templates/agent-support/.opencode/skills/writing-docs-pages/reference/docouture-blocks.md +170 -0
- package/build/templates/agent-support/.opencode/skills/writing-docs-pages/reference/language-basics.md +402 -0
- package/build/templates/agent-support/AGENTS.md +72 -0
- package/build/templates/starter/antora-playbook.local.yml +99 -0
- package/build/templates/starter/antora-playbook.versioned.yml +167 -0
- package/build/templates/starter/antora-playbook.yml +189 -0
- package/build/templates/starter/gitignore +3 -0
- package/build/templates/starter/package.json +37 -0
- package/build/templates/starter/scripts/check-links.mjs +178 -0
- package/build/templates/starter/src/antora.yml +85 -0
- package/build/templates/starter/src/modules/ROOT/images/card-placeholder.png +0 -0
- package/build/templates/starter/src/modules/ROOT/images/feature-placeholder-dark.png +0 -0
- package/build/templates/starter/src/modules/ROOT/images/feature-placeholder.png +0 -0
- package/build/templates/starter/src/modules/ROOT/images/hero-placeholder.png +0 -0
- package/build/templates/starter/src/modules/ROOT/pages/index.adoc +124 -0
- package/build/templates/starter/src/modules/main/nav.adoc +19 -0
- package/build/templates/starter/src/modules/main/pages/app.adoc +5 -0
- package/build/templates/starter/src/modules/main/pages/architecture.adoc +6 -0
- package/build/templates/starter/src/modules/main/pages/changelog/index.adoc +9 -0
- package/build/templates/starter/src/modules/main/pages/components.adoc +701 -0
- package/build/templates/starter/src/modules/main/pages/contributing.adoc +6 -0
- package/build/templates/starter/src/modules/main/pages/getting-started.adoc +169 -0
- package/build/templates/starter/src/modules/main/pages/glossary.adoc +8 -0
- package/build/templates/starter/src/modules/main/pages/index.adoc +9 -0
- package/build/templates/starter/src/modules/main/pages/prerequisites.adoc +55 -0
- package/build/templates/starter/src/modules/main/pages/quickstart.adoc +21 -0
- package/build/templates/starter/src/modules/main/pages/release-notes/index.adoc +9 -0
- package/build/templates/starter/src/modules/main/pages/requirements.adoc +8 -0
- package/build/templates/starter/src/modules/main/pages/roadmap.adoc +4 -0
- package/build/templates/starter/src/modules/main/pages/structure.adoc +5 -0
- package/build/templates/starter/src/release-version.versioned +1 -0
- package/build/templates/starter/supplemental-ui/favicon.ico +0 -0
- package/build/templates/starter/supplemental-ui/product-logo-dark.png +0 -0
- package/build/templates/starter/supplemental-ui/product-logo.png +0 -0
- package/build/templates/workflows/docouture-kroki-cache-warm.yml +101 -0
- package/build/templates/workflows/docouture-pr-verify.yml +120 -0
- package/build/templates/workflows/docouture-publish-prerelease.yml +122 -0
- package/build/templates/workflows/docouture-publish.yml +138 -0
- package/build/templates/workflows/docouture-release-preview.yml +198 -0
- package/build/templates/workflows/docouture-release.yml +414 -0
- package/package.json +38 -0
|
@@ -0,0 +1,414 @@
|
|
|
1
|
+
name: docouture-release
|
|
2
|
+
|
|
3
|
+
# Handles BOTH versioning modes — see the docouture docs-site-package skill's
|
|
4
|
+
# versioning-modes.md for the full mechanism. Which mode a site is on is
|
|
5
|
+
# detected, not asked: `docs/antora-playbook.yml`'s own content.sources[]
|
|
6
|
+
# tags permanently say `tags: ['v*']` under versioned (Full History) or
|
|
7
|
+
# `tags: ['stable']` under standalone (Stable + Prerelease) from the moment a
|
|
8
|
+
# site opts into either — see the `Detect mode` step below. `docs/antora.yml`
|
|
9
|
+
# on `main` is identical for both modes (`version: prerelease`,
|
|
10
|
+
# `prerelease: true`) and is never read for this. Adopting a mode in the
|
|
11
|
+
# first place (setting antora-playbook.yml's content.sources[] tags/branches)
|
|
12
|
+
# is still a manual, one-time edit; this workflow only handles cutting
|
|
13
|
+
# releases afterwards.
|
|
14
|
+
#
|
|
15
|
+
# Prerequisite, done once, not by this workflow: this site's own
|
|
16
|
+
# antora-playbook.yml content.sources[] must already match
|
|
17
|
+
# `branches: [main]` + `tags: ['v*']` (versioned) or `branches: [main]` +
|
|
18
|
+
# `tags: ['stable']` (standalone).
|
|
19
|
+
#
|
|
20
|
+
# Two ways to run this, both deliberate acts rather than a side effect of an
|
|
21
|
+
# ordinary push:
|
|
22
|
+
#
|
|
23
|
+
# 1. workflow_dispatch — a person runs it by hand and supplies `version`
|
|
24
|
+
# (versioned) or leaves it as the default (standalone).
|
|
25
|
+
# 2. Automatically, when a pull request carrying the `docs/release` label
|
|
26
|
+
# is merged into a branch matching `main*`. This path has no input to
|
|
27
|
+
# type a version into: standalone doesn't need one (always `stable`);
|
|
28
|
+
# versioned reads it from `docs/.release-version`, a plain-text file
|
|
29
|
+
# the PR itself commits with the target version — reviewed as part of
|
|
30
|
+
# that PR's diff, like any other change.
|
|
31
|
+
#
|
|
32
|
+
# Republishing (versioned only): a fix that needs to land on an
|
|
33
|
+
# already-released version overwrites that version's tag — this workflow
|
|
34
|
+
# always force-recreates a tag that already exists, both modes, no separate
|
|
35
|
+
# flag or label needed. `docs/.release-version` itself is never cleared by
|
|
36
|
+
# hand: after every successful versioned release that is NOT a republish,
|
|
37
|
+
# this workflow bumps it forward to the next patch version on `main` (see
|
|
38
|
+
# "Bump release descriptor" below), so the file always holds a sane next
|
|
39
|
+
# target rather than going stale. A republish (the target tag already
|
|
40
|
+
# existed) skips that bump, since `docs/.release-version` already holds
|
|
41
|
+
# whatever was planned to come after it.
|
|
42
|
+
on:
|
|
43
|
+
workflow_dispatch:
|
|
44
|
+
inputs:
|
|
45
|
+
version:
|
|
46
|
+
description: >-
|
|
47
|
+
Target version for a versioned release, e.g. 1.2.0 (becomes tag
|
|
48
|
+
v1.2.0). Leave as 'stable' for a standalone site — that mode's
|
|
49
|
+
target is always the 'stable' tag, this input is ignored there.
|
|
50
|
+
required: true
|
|
51
|
+
type: string
|
|
52
|
+
default: 'stable'
|
|
53
|
+
pull_request:
|
|
54
|
+
types: [closed]
|
|
55
|
+
branches: ['main*']
|
|
56
|
+
|
|
57
|
+
permissions:
|
|
58
|
+
contents: write
|
|
59
|
+
pull-requests: write
|
|
60
|
+
|
|
61
|
+
concurrency:
|
|
62
|
+
group: docouture-release
|
|
63
|
+
cancel-in-progress: false
|
|
64
|
+
|
|
65
|
+
jobs:
|
|
66
|
+
release:
|
|
67
|
+
name: Cut release
|
|
68
|
+
runs-on: ubuntu-latest
|
|
69
|
+
timeout-minutes: 15
|
|
70
|
+
# `docouture new` scaffolds this site's package.json, antora-playbook.yml,
|
|
71
|
+
# docs/antora.yml etc. under docs/ (not the repository root) — see the
|
|
72
|
+
# docs-site-package skill's reference/versioning-modes.md. Every step
|
|
73
|
+
# below — including the git ones, so `docs/antora.yml` below really
|
|
74
|
+
# means the descriptor at docs/src/antora.yml relative to the repo
|
|
75
|
+
# root — runs from there; only .github/workflows itself has to live at
|
|
76
|
+
# the true repo root, since that is the one path GitHub Actions
|
|
77
|
+
# requires.
|
|
78
|
+
defaults:
|
|
79
|
+
run:
|
|
80
|
+
working-directory: docs
|
|
81
|
+
# workflow_dispatch always proceeds (it's already an explicit, deliberate
|
|
82
|
+
# act). The pull_request trigger fires on every close of a PR targeting
|
|
83
|
+
# main* — including ones that were closed unmerged, or merged without the
|
|
84
|
+
# label — so it only proceeds when both are true: actually merged, and
|
|
85
|
+
# carrying `docs/release`. Anything else is a no-op run, not an error.
|
|
86
|
+
if: >-
|
|
87
|
+
github.event_name == 'workflow_dispatch' ||
|
|
88
|
+
(github.event.pull_request.merged == true &&
|
|
89
|
+
contains(github.event.pull_request.labels.*.name, 'docs/release'))
|
|
90
|
+
steps:
|
|
91
|
+
- name: Require main
|
|
92
|
+
# Only meaningful for a manual dispatch: someone could run this
|
|
93
|
+
# workflow with a non-main branch selected in the "Run workflow" UI.
|
|
94
|
+
# The pull_request trigger can't have this problem — the `branches:`
|
|
95
|
+
# filter above already restricted it to main* before the job started,
|
|
96
|
+
# and by the time a `closed`+`merged` event fires, main already
|
|
97
|
+
# reflects the merge.
|
|
98
|
+
if: github.event_name == 'workflow_dispatch' && github.ref != 'refs/heads/main'
|
|
99
|
+
run: |
|
|
100
|
+
echo "::error::docouture-release must run against main (got ${{ github.ref }})"
|
|
101
|
+
exit 1
|
|
102
|
+
|
|
103
|
+
- name: Checkout
|
|
104
|
+
uses: actions/checkout@v4
|
|
105
|
+
with:
|
|
106
|
+
# Standalone moves an existing `stable` tag, which has to already
|
|
107
|
+
# be reachable in history to be force-moved. Versioned only ever
|
|
108
|
+
# creates a brand-new tag on a brand-new commit and doesn't
|
|
109
|
+
# strictly need this, but the detect step below needs main's tip
|
|
110
|
+
# either way, and full history is harmless for that case.
|
|
111
|
+
fetch-depth: 0
|
|
112
|
+
ref: main
|
|
113
|
+
|
|
114
|
+
# __DOCOUTURE_PM_SETUP_STEP__
|
|
115
|
+
- name: Setup Node
|
|
116
|
+
uses: actions/setup-node@v4
|
|
117
|
+
with:
|
|
118
|
+
# Reads engines.node from docs/package.json — no separate version
|
|
119
|
+
# file to keep in sync.
|
|
120
|
+
node-version-file: docs/package.json
|
|
121
|
+
cache: __DOCOUTURE_PM_CACHE__
|
|
122
|
+
# `defaults.run.working-directory: docs` above only applies to
|
|
123
|
+
# `run:` steps, not to this action's own inputs — without this,
|
|
124
|
+
# setup-node looks for a lockfile from the repo root and fails.
|
|
125
|
+
cache-dependency-path: docs/__DOCOUTURE_LOCKFILE__
|
|
126
|
+
|
|
127
|
+
- name: Install dependencies
|
|
128
|
+
run: __DOCOUTURE_INSTALL_CI__
|
|
129
|
+
|
|
130
|
+
# See docouture-pr-verify.yml's own comment: this build reads
|
|
131
|
+
# antora-playbook.local.yml (Build docs below), not the real
|
|
132
|
+
# antora-playbook.yml — same reason as that step's own "Detect mode"
|
|
133
|
+
# doesn't apply here (the tag this run is about to cut doesn't exist
|
|
134
|
+
# yet, per Build docs' own comment), so the enabled check has to look
|
|
135
|
+
# at the same file Build docs actually builds.
|
|
136
|
+
- name: Kroki / Detect enabled
|
|
137
|
+
id: kroki-check
|
|
138
|
+
run: |
|
|
139
|
+
if grep -qE "^\s*kroki-enabled:\s*['\"]?true['\"]?\s*(#.*)?$" antora-playbook.local.yml; then
|
|
140
|
+
echo "enabled=true" >> "$GITHUB_OUTPUT"
|
|
141
|
+
else
|
|
142
|
+
echo "enabled=false" >> "$GITHUB_OUTPUT"
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
# See docouture-pr-verify.yml's own comment: primes the runner's Docker
|
|
146
|
+
# image store before the Build step's implicit Kroki startup.
|
|
147
|
+
- name: Kroki / Docker image cache
|
|
148
|
+
id: kroki-cache
|
|
149
|
+
if: steps.kroki-check.outputs.enabled == 'true'
|
|
150
|
+
uses: actions/cache@v4
|
|
151
|
+
with:
|
|
152
|
+
path: /tmp/kroki-images.tar
|
|
153
|
+
key: ${{ runner.os }}-kroki-images-${{ hashFiles('**/kroki-compose.yml') }}
|
|
154
|
+
|
|
155
|
+
- name: Kroki / Load cached images
|
|
156
|
+
if: steps.kroki-check.outputs.enabled == 'true' && steps.kroki-cache.outputs.cache-hit == 'true'
|
|
157
|
+
run: docker load -i /tmp/kroki-images.tar
|
|
158
|
+
|
|
159
|
+
- name: Kroki / Pull and save images
|
|
160
|
+
if: steps.kroki-check.outputs.enabled == 'true' && steps.kroki-cache.outputs.cache-hit != 'true'
|
|
161
|
+
run: |
|
|
162
|
+
compose_file="$(find . -name kroki-compose.yml 2>/dev/null | head -1)"
|
|
163
|
+
docker compose -f "$compose_file" pull
|
|
164
|
+
docker save -o /tmp/kroki-images.tar $(docker compose -f "$compose_file" config --images)
|
|
165
|
+
|
|
166
|
+
# Nothing before this point has actually built the docs — unlike
|
|
167
|
+
# docouture-pr-verify.yml and docouture-publish.yml, this workflow previously
|
|
168
|
+
# went straight from install to cutting a release tag. That let a
|
|
169
|
+
# broken site get tagged and released, only to be caught later, when
|
|
170
|
+
# the tag push triggers docouture-publish.yml downstream. Building here
|
|
171
|
+
# too, before any git mutation below, catches it before a tag or
|
|
172
|
+
# GitHub Release ever exists for it.
|
|
173
|
+
#
|
|
174
|
+
# `antora-playbook.local.yml` (branches: HEAD), not the real
|
|
175
|
+
# antora-playbook.yml: the tag this run is about to cut doesn't exist
|
|
176
|
+
# yet, so the real playbook's tag-based content source can't see it —
|
|
177
|
+
# it would just rebuild whatever was already released, not what's
|
|
178
|
+
# about to ship. The local playbook validates exactly the content on
|
|
179
|
+
# `main` right now, which is what the new version will actually be.
|
|
180
|
+
- name: Build docs
|
|
181
|
+
run: npx antora --fetch antora-playbook.local.yml
|
|
182
|
+
|
|
183
|
+
# See docouture-pr-verify.yml's own comment: catches raw http(s) links
|
|
184
|
+
# Antora's own strict mode (runtime.log.failure_level: warn, already
|
|
185
|
+
# exercised by Build above) can't see. Only a broken EXTERNAL link
|
|
186
|
+
# fails this step — a broken local one is a warning only, since this
|
|
187
|
+
# job also builds with antora-playbook.local.yml (see that comment for
|
|
188
|
+
# why a local link can legitimately look broken here).
|
|
189
|
+
- name: Check links
|
|
190
|
+
run: __DOCOUTURE_PM__ run check-links
|
|
191
|
+
|
|
192
|
+
- name: git identity
|
|
193
|
+
run: |
|
|
194
|
+
git config user.name "github-actions[bot]"
|
|
195
|
+
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
196
|
+
|
|
197
|
+
# The one signal this workflow trusts: docs/antora-playbook.yml's own
|
|
198
|
+
# content.sources[] tags permanently say `tags: ['v*']` (versioned) or
|
|
199
|
+
# `tags: ['stable']` (standalone) from the moment a site opts into that
|
|
200
|
+
# mode — see this file's header and versioning-modes.md. Anything else
|
|
201
|
+
# there is treated as misconfiguration, not a third mode. Unlike
|
|
202
|
+
# docs/antora.yml elsewhere in this job — which really means
|
|
203
|
+
# docs/src/antora.yml relative to the repo root, per this job's own
|
|
204
|
+
# working-directory comment above — antora-playbook.yml sits directly
|
|
205
|
+
# under docs/ (one level, not nested), so it's read here bare, without
|
|
206
|
+
# a docs/ prefix.
|
|
207
|
+
- name: Detect mode
|
|
208
|
+
id: detect
|
|
209
|
+
run: |
|
|
210
|
+
line=$(grep -E "tags:" antora-playbook.yml | head -1)
|
|
211
|
+
|
|
212
|
+
case "$line" in
|
|
213
|
+
*"v*"*) mode=versioned ;;
|
|
214
|
+
*stable*) mode=standalone ;;
|
|
215
|
+
*)
|
|
216
|
+
echo "::error::antora-playbook.yml's content.sources[] has tags: '${line}' — expected something matching 'v*' (versioned) or 'stable' (standalone). See versioning-modes.md's 'Prerequisite' note."
|
|
217
|
+
exit 1
|
|
218
|
+
;;
|
|
219
|
+
esac
|
|
220
|
+
|
|
221
|
+
echo "mode=${mode}" >> "$GITHUB_OUTPUT"
|
|
222
|
+
echo "Detected ${mode} (antora-playbook.yml: ${line})"
|
|
223
|
+
|
|
224
|
+
# Where the target version comes from depends on how this run started:
|
|
225
|
+
# a person typed it (workflow_dispatch) or the merged PR committed it
|
|
226
|
+
# (docs/.release-version). Standalone ignores whatever this resolves to
|
|
227
|
+
# either way — it always targets `stable` — but it's still resolved
|
|
228
|
+
# uniformly here so later steps don't need to know which trigger fired.
|
|
229
|
+
- name: Resolve version
|
|
230
|
+
id: resolve
|
|
231
|
+
env:
|
|
232
|
+
EVENT: ${{ github.event_name }}
|
|
233
|
+
DISPATCH_VERSION: ${{ inputs.version }}
|
|
234
|
+
run: |
|
|
235
|
+
if [ "$EVENT" = "workflow_dispatch" ]; then
|
|
236
|
+
version="$DISPATCH_VERSION"
|
|
237
|
+
source="workflow_dispatch input"
|
|
238
|
+
elif [ -f .release-version ]; then
|
|
239
|
+
version=$(tr -d '[:space:]' < .release-version)
|
|
240
|
+
source="docs/.release-version"
|
|
241
|
+
else
|
|
242
|
+
version=""
|
|
243
|
+
source="docs/.release-version (missing)"
|
|
244
|
+
fi
|
|
245
|
+
|
|
246
|
+
echo "version=${version}" >> "$GITHUB_OUTPUT"
|
|
247
|
+
echo "Resolved version '${version}' from ${source}"
|
|
248
|
+
|
|
249
|
+
- name: Validate version
|
|
250
|
+
env:
|
|
251
|
+
MODE: ${{ steps.detect.outputs.mode }}
|
|
252
|
+
EVENT: ${{ github.event_name }}
|
|
253
|
+
VERSION: ${{ steps.resolve.outputs.version }}
|
|
254
|
+
run: |
|
|
255
|
+
if [ "$MODE" = "versioned" ] && [ -z "$VERSION" ]; then
|
|
256
|
+
if [ "$EVENT" = "workflow_dispatch" ]; then
|
|
257
|
+
echo "::error::Versioned mode requires a real target version — re-run with a 'version' input other than the default 'stable', e.g. 1.2.0."
|
|
258
|
+
else
|
|
259
|
+
echo "::error::Versioned mode requires a real target version, and this PR carried no docs/.release-version — add that file with the target version (e.g. 1.2.0) before merging with the docs/release label, or run docouture-release manually via workflow_dispatch instead."
|
|
260
|
+
fi
|
|
261
|
+
exit 1
|
|
262
|
+
fi
|
|
263
|
+
|
|
264
|
+
if [ "$MODE" = "versioned" ] && [ "$VERSION" = "stable" ]; then
|
|
265
|
+
echo "::error::'stable' is standalone's target name, not a valid versioned-mode version — use a real version, e.g. 1.2.0."
|
|
266
|
+
exit 1
|
|
267
|
+
fi
|
|
268
|
+
|
|
269
|
+
if [ "$MODE" = "standalone" ] && [ -n "$VERSION" ] && [ "$VERSION" != "stable" ]; then
|
|
270
|
+
echo "::warning::Standalone mode always releases to the 'stable' tag — ignoring provided version '${VERSION}'."
|
|
271
|
+
fi
|
|
272
|
+
|
|
273
|
+
# `main`'s own docs/antora.yml is never touched here — it permanently
|
|
274
|
+
# says version: prerelease (both modes). This step patches a COMMIT,
|
|
275
|
+
# not main itself: `docouture version <value>` edits the working tree,
|
|
276
|
+
# that edit is committed on top of main's current tip, and then main
|
|
277
|
+
# is reset back to that same tip immediately after — so the commit's
|
|
278
|
+
# only route into the repository's reachable history is whichever tag
|
|
279
|
+
# points at it next (pushed in the following step). It is deliberately
|
|
280
|
+
# never pushed as part of `main`.
|
|
281
|
+
- name: Cut release
|
|
282
|
+
id: cut
|
|
283
|
+
env:
|
|
284
|
+
MODE: ${{ steps.detect.outputs.mode }}
|
|
285
|
+
VERSION: ${{ steps.resolve.outputs.version }}
|
|
286
|
+
run: |
|
|
287
|
+
if [ "$MODE" = "versioned" ]; then
|
|
288
|
+
value="$VERSION"
|
|
289
|
+
tag="v${value}"
|
|
290
|
+
else
|
|
291
|
+
value="stable"
|
|
292
|
+
tag="stable"
|
|
293
|
+
fi
|
|
294
|
+
|
|
295
|
+
base=$(git rev-parse HEAD)
|
|
296
|
+
|
|
297
|
+
npx docouture version "$value"
|
|
298
|
+
git add src/antora.yml
|
|
299
|
+
git commit -m "chore: docs release ${tag}"
|
|
300
|
+
sha=$(git rev-parse HEAD)
|
|
301
|
+
|
|
302
|
+
# Detach main back to its real tip. The commit just made keeps
|
|
303
|
+
# existing (git doesn't garbage-collect same-run objects), it's
|
|
304
|
+
# just no longer what any local branch points at.
|
|
305
|
+
git reset --hard "$base"
|
|
306
|
+
|
|
307
|
+
echo "sha=${sha}" >> "$GITHUB_OUTPUT"
|
|
308
|
+
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
|
|
309
|
+
|
|
310
|
+
# Versioned only: whether this exact version was released before
|
|
311
|
+
# decides whether "Bump release descriptor" below runs — a republish
|
|
312
|
+
# (the tag already existed) must NOT bump docs/.release-version
|
|
313
|
+
# forward, since that file already holds whatever was planned to come
|
|
314
|
+
# after this republished version. Standalone has no equivalent need —
|
|
315
|
+
# `stable` is a rolling pointer, always overwritten, and there's no
|
|
316
|
+
# release-version file to protect.
|
|
317
|
+
- name: Check for existing release
|
|
318
|
+
if: steps.detect.outputs.mode == 'versioned'
|
|
319
|
+
id: check
|
|
320
|
+
env:
|
|
321
|
+
TAG: ${{ steps.cut.outputs.tag }}
|
|
322
|
+
run: |
|
|
323
|
+
if git ls-remote --exit-code --tags origin "refs/tags/${TAG}" >/dev/null 2>&1; then
|
|
324
|
+
echo "existed=true" >> "$GITHUB_OUTPUT"
|
|
325
|
+
echo "${TAG} already exists — republishing (force)."
|
|
326
|
+
else
|
|
327
|
+
echo "existed=false" >> "$GITHUB_OUTPUT"
|
|
328
|
+
echo "${TAG} is new."
|
|
329
|
+
fi
|
|
330
|
+
|
|
331
|
+
# Every release tag is force-recreated if it already exists — both
|
|
332
|
+
# modes, unconditionally. Standalone's `stable` is a rolling pointer by
|
|
333
|
+
# design; versioned's vX.Y.Z tags are meant to be immutable once
|
|
334
|
+
# released, but a republish (fixing a released version) is a
|
|
335
|
+
# deliberate, ordinary act here, not something gated behind a separate
|
|
336
|
+
# flag or label.
|
|
337
|
+
- name: Push release tag
|
|
338
|
+
env:
|
|
339
|
+
TAG: ${{ steps.cut.outputs.tag }}
|
|
340
|
+
SHA: ${{ steps.cut.outputs.sha }}
|
|
341
|
+
run: |
|
|
342
|
+
git tag -f "$TAG" "$SHA"
|
|
343
|
+
git push origin "refs/tags/${TAG}" --force
|
|
344
|
+
|
|
345
|
+
# Versioned only: every version is kept forever, so each one gets a
|
|
346
|
+
# real Release entry. Standalone deliberately skips this — `stable` is
|
|
347
|
+
# a rolling pointer with no changelog value of its own, and that mode
|
|
348
|
+
# keeps no version history to attach one to (see versioning-modes.md).
|
|
349
|
+
# The delete-then-create is a no-op the first time a version is
|
|
350
|
+
# released (nothing to delete); on a republish it drops the stale
|
|
351
|
+
# Release object first so `create` doesn't just fail against one that
|
|
352
|
+
# already exists.
|
|
353
|
+
- name: Create GitHub Release
|
|
354
|
+
if: steps.detect.outputs.mode == 'versioned'
|
|
355
|
+
env:
|
|
356
|
+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
357
|
+
TAG: ${{ steps.cut.outputs.tag }}
|
|
358
|
+
SHA: ${{ steps.cut.outputs.sha }}
|
|
359
|
+
run: |
|
|
360
|
+
gh release delete "$TAG" --yes 2>/dev/null || true
|
|
361
|
+
gh release create "$TAG" --title "$TAG" --generate-notes --target "$SHA"
|
|
362
|
+
|
|
363
|
+
# Versioned only, and only on a genuine forward release (not a
|
|
364
|
+
# republish of an already-released version — see "Check for existing
|
|
365
|
+
# release" above): docs/.release-version needs a sane value again
|
|
366
|
+
# immediately or the next docs/release merge has nothing to read (see
|
|
367
|
+
# "Validate version" above). Rather than clearing it, bump it forward
|
|
368
|
+
# one patch version — the same idiom `just bump` uses for this
|
|
369
|
+
# workspace's own npm packages: let `npm version` do the semver
|
|
370
|
+
# arithmetic against a throwaway package.json instead of hand-rolling
|
|
371
|
+
# it, then read the result back out. This is a real commit directly on
|
|
372
|
+
# `main` (unlike "Cut release" above, which deliberately never
|
|
373
|
+
# advances main) — it's just bookkeeping, not a release. Skipped on a
|
|
374
|
+
# republish: that run's target version was already superseded by
|
|
375
|
+
# whatever docs/.release-version currently holds, so bumping forward
|
|
376
|
+
# from it would clobber that already-planned next target instead of
|
|
377
|
+
# protecting it.
|
|
378
|
+
- name: Bump release descriptor
|
|
379
|
+
if: steps.detect.outputs.mode == 'versioned' && steps.check.outputs.existed != 'true'
|
|
380
|
+
env:
|
|
381
|
+
VERSION: ${{ steps.resolve.outputs.version }}
|
|
382
|
+
run: |
|
|
383
|
+
dir=$(mktemp -d)
|
|
384
|
+
echo '{"name":"docs-release-version","version":"'"${VERSION}"'"}' > "${dir}/package.json"
|
|
385
|
+
npm --prefix "${dir}" version patch --no-git-tag-version --loglevel error >/dev/null
|
|
386
|
+
next=$(node -p "require('${dir}/package.json').version")
|
|
387
|
+
|
|
388
|
+
echo "${next}" > .release-version
|
|
389
|
+
git add .release-version
|
|
390
|
+
git commit -m "chore: bump docs/.release-version to ${next}"
|
|
391
|
+
git push origin main
|
|
392
|
+
|
|
393
|
+
echo "docs/.release-version: ${VERSION} → ${next}"
|
|
394
|
+
|
|
395
|
+
# Rebuild/deploy: called directly here, as a reusable job, rather than
|
|
396
|
+
# relying on docouture-publish.yml's own trigger reacting to the pushes
|
|
397
|
+
# above — a plain `on: push` there previously had two problems: (1) it
|
|
398
|
+
# matched both the tag push above AND main's ordinary pushes, so an
|
|
399
|
+
# unrelated commit to main (or this job's own release-version bump
|
|
400
|
+
# commit, previously pushed to main directly) could kick off a publish
|
|
401
|
+
# with nothing to do with a release, and (2) both this job's tag push
|
|
402
|
+
# and its main push could each independently match, firing publish
|
|
403
|
+
# twice for one release with no ordering guarantee between them. A
|
|
404
|
+
# direct `needs:` job dependency below has neither problem: publish
|
|
405
|
+
# only ever runs once, only after this job finishes, and only when it
|
|
406
|
+
# actually cut something (`needs.release.result == 'success'` is
|
|
407
|
+
# already false for a no-op run — see this job's own `if:` above,
|
|
408
|
+
# which makes a run that doesn't match skip rather than succeed).
|
|
409
|
+
publish:
|
|
410
|
+
name: Publish
|
|
411
|
+
needs: release
|
|
412
|
+
if: needs.release.result == 'success'
|
|
413
|
+
uses: ./.github/workflows/docouture-publish.yml
|
|
414
|
+
secrets: inherit
|
package/package.json
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@inditextech/docouture-cli",
|
|
3
|
+
"version": "0.1.0-SNAPSHOT.40.1",
|
|
4
|
+
"description": "Command-line tool for docouture documentation sites: scaffold a new site and set its Antora version outside the monorepo",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/InditexTech/test-antoradocs.git",
|
|
8
|
+
"directory": "code/packages/cli"
|
|
9
|
+
},
|
|
10
|
+
"license": "MPL-2.0",
|
|
11
|
+
"type": "module",
|
|
12
|
+
"bin": {
|
|
13
|
+
"docouture": "build/bin.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"build",
|
|
17
|
+
"!build/**/*.map"
|
|
18
|
+
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=24.0.0"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@inquirer/prompts": "^7.0.0",
|
|
24
|
+
"ora": "^8.2.0"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "~24.10.1",
|
|
28
|
+
"typescript": "6.0.3"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"build": "tsc -p tsconfig.json && node scripts/copy-templates.mjs && node scripts/chmod-bin.mjs",
|
|
32
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
33
|
+
"test": "npm run build && vitest run",
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"lint:fix": "eslint . --fix",
|
|
36
|
+
"clean": "node -e \"require('fs').rmSync('build', { recursive: true, force: true })\""
|
|
37
|
+
}
|
|
38
|
+
}
|