versite 0.1.4__tar.gz → 0.2.0__tar.gz
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.
- versite-0.2.0/PKG-INFO +541 -0
- versite-0.2.0/README.md +529 -0
- {versite-0.1.4 → versite-0.2.0}/pyproject.toml +3 -1
- versite-0.2.0/tests/test_action.py +119 -0
- versite-0.2.0/tests/test_cli.py +182 -0
- versite-0.2.0/tests/test_commands.py +937 -0
- versite-0.2.0/tests/test_config.py +87 -0
- versite-0.2.0/tests/test_git_utils.py +133 -0
- versite-0.2.0/tests/test_jsonpath.py +108 -0
- versite-0.2.0/tests/test_redirects.py +38 -0
- versite-0.2.0/tests/test_release.py +59 -0
- versite-0.2.0/tests/test_versions.py +186 -0
- versite-0.2.0/versite/__init__.py +0 -0
- versite-0.2.0/versite/cli.py +216 -0
- {versite-0.1.4 → versite-0.2.0}/versite/commands.py +119 -102
- {versite-0.1.4 → versite-0.2.0}/versite/config.py +6 -4
- {versite-0.1.4 → versite-0.2.0}/versite/git_utils.py +47 -9
- versite-0.2.0/versite/jsonpath.py +117 -0
- {versite-0.1.4 → versite-0.2.0}/versite/redirects.py +4 -1
- {versite-0.1.4 → versite-0.2.0}/versite/versions.py +43 -10
- versite-0.2.0/versite.egg-info/PKG-INFO +541 -0
- {versite-0.1.4 → versite-0.2.0}/versite.egg-info/SOURCES.txt +4 -3
- {versite-0.1.4 → versite-0.2.0}/versite.egg-info/requires.txt +2 -0
- versite-0.1.4/PKG-INFO +0 -283
- versite-0.1.4/README.md +0 -273
- versite-0.1.4/tests/test_cli.py +0 -17
- versite-0.1.4/tests/test_config.py +0 -33
- versite-0.1.4/tests/test_deploy.py +0 -225
- versite-0.1.4/tests/test_git_utils.py +0 -124
- versite-0.1.4/tests/test_non_build_commands_do_not_import_builders.py +0 -30
- versite-0.1.4/tests/test_non_build_commands_do_not_run_builders.py +0 -24
- versite-0.1.4/tests/test_redirects.py +0 -16
- versite-0.1.4/tests/test_versions.py +0 -84
- versite-0.1.4/versite/__init__.py +0 -3
- versite-0.1.4/versite/cli.py +0 -174
- versite-0.1.4/versite/jsonpath.py +0 -81
- versite-0.1.4/versite.egg-info/PKG-INFO +0 -283
- {versite-0.1.4 → versite-0.2.0}/setup.cfg +0 -0
- {versite-0.1.4 → versite-0.2.0}/versite/serve.py +0 -0
- {versite-0.1.4 → versite-0.2.0}/versite/templates/__init__.py +0 -0
- {versite-0.1.4 → versite-0.2.0}/versite/templates/redirect.html +0 -0
- {versite-0.1.4 → versite-0.2.0}/versite.egg-info/dependency_links.txt +0 -0
- {versite-0.1.4 → versite-0.2.0}/versite.egg-info/entry_points.txt +0 -0
- {versite-0.1.4 → versite-0.2.0}/versite.egg-info/top_level.txt +0 -0
versite-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: versite
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Versioned static-site deployments for prebuilt static directories
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: click<9,>=8.1
|
|
8
|
+
Requires-Dist: PyYAML>=6.0
|
|
9
|
+
Requires-Dist: Jinja2>=3.1
|
|
10
|
+
Requires-Dist: pyparsing<4,>=3.0
|
|
11
|
+
Requires-Dist: inversion<2,>=1.0.1
|
|
12
|
+
|
|
13
|
+
# versite
|
|
14
|
+
|
|
15
|
+
Versite manages versioned documentation for any static site generator. Build
|
|
16
|
+
your site with MkDocs, Jekyll, or another tool, then use versite to publish
|
|
17
|
+
versions, manage aliases, and choose a default version.
|
|
18
|
+
|
|
19
|
+
Each version has its own directory in a Git deployment branch, so older
|
|
20
|
+
versions stay available at their existing URLs. Versite manages the built files,
|
|
21
|
+
redirects, and version metadata independently of your build tool.
|
|
22
|
+
|
|
23
|
+
For an existing mike deployment, see
|
|
24
|
+
[Migrate from mike to versite](MIGRATING.md).
|
|
25
|
+
|
|
26
|
+
## Install versite
|
|
27
|
+
|
|
28
|
+
You need Python 3.10 or later and Git. Install versite from this repository:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
python -m pip install "git+https://github.com/PrimerPages/versite.git"
|
|
32
|
+
versite --help
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Deploy a version
|
|
36
|
+
|
|
37
|
+
Run these commands from your site's Git repository. The repository must have
|
|
38
|
+
at least one commit and an `origin` remote configured for your deployment
|
|
39
|
+
repository.
|
|
40
|
+
|
|
41
|
+
1. Build your site into a directory such as `dist/site`. Configure your site
|
|
42
|
+
generator to use the version's URL path. For example, version `1.0` hosted at
|
|
43
|
+
`https://example.com/project/1.0/` needs a base path of `/project/1.0`.
|
|
44
|
+
2. Deploy the built files and assign the `latest` alias:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
versite deploy 1.0 latest --site-dir dist/site --push
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
3. Set the root URL to redirect to `latest`:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
versite set-default latest --push
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
By default, versite stores the site in the `gh-pages` branch. Version `1.0` is
|
|
57
|
+
available under `1.0/`, and `latest/` redirects to that version. Deploying a new
|
|
58
|
+
version preserves the existing versions. Redeploying a version refreshes all
|
|
59
|
+
aliases attached to it, even if you omit those aliases from the command.
|
|
60
|
+
|
|
61
|
+
If the deployment directory has no `index.html`, versite creates a default
|
|
62
|
+
redirect to the first alias you pass, or to the version if you pass no aliases.
|
|
63
|
+
Later deployments preserve that redirect. Use `set-default` to change it.
|
|
64
|
+
|
|
65
|
+
To set a display title and properties while deploying, use `--title` and the
|
|
66
|
+
`--prop-*` options:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
versite deploy 1.0 latest --site-dir dist/site \
|
|
70
|
+
--title "Version 1.0" \
|
|
71
|
+
--prop-set hidden=false \
|
|
72
|
+
--prop-set-string channel=stable \
|
|
73
|
+
--push
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Versite commits the content, aliases, title, and properties together. Omit the
|
|
77
|
+
metadata options to preserve a version's existing title and properties. New
|
|
78
|
+
versions use their version identifier as the title and start with no properties.
|
|
79
|
+
|
|
80
|
+
To deploy locally without publishing, use `--no-push`. Run `versite serve` to
|
|
81
|
+
preview the local deployment branch at `http://127.0.0.1:8000`.
|
|
82
|
+
|
|
83
|
+
These commands update the deployment branch. Your host serves the files from
|
|
84
|
+
that branch or from a deployment artifact. For GitHub Pages, see
|
|
85
|
+
[Publish with GitHub Pages](#publish-with-github-pages).
|
|
86
|
+
|
|
87
|
+
For build examples, see [Build for versioned URLs](#build-for-versioned-urls).
|
|
88
|
+
|
|
89
|
+
## Configure deployments
|
|
90
|
+
|
|
91
|
+
Versite uses the following defaults when there is no `versite.yml` in your
|
|
92
|
+
current directory. To change them, create `versite.yml`:
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
remote: origin
|
|
96
|
+
branch: gh-pages
|
|
97
|
+
fetch: false
|
|
98
|
+
push: false
|
|
99
|
+
alias_type: redirect
|
|
100
|
+
deploy_prefix: ""
|
|
101
|
+
redirect_template: null
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
Command-line options override these settings. For example, to deploy to a
|
|
105
|
+
branch named `docs`:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
versite deploy 1.0 --site-dir dist/site --branch docs --push
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Use `--config-file PATH` to read a different configuration file. If you specify
|
|
112
|
+
a file that doesn't exist, the command fails.
|
|
113
|
+
|
|
114
|
+
## Manage versions
|
|
115
|
+
|
|
116
|
+
Use a version identifier or one of its aliases to select a published version.
|
|
117
|
+
Add `--push` to commands that change the deployment branch when you want to
|
|
118
|
+
push those changes to your remote. If you assign an existing alias to another
|
|
119
|
+
version, versite moves that alias to the selected version.
|
|
120
|
+
|
|
121
|
+
| Task | Command |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| List versions and aliases. | `versite list` |
|
|
124
|
+
| Get version metadata as JSON. | `versite list 1.0 --json` |
|
|
125
|
+
| Assign an alias to a version. | `versite alias 1.0 stable --push` |
|
|
126
|
+
| Change a version's display title. | `versite retitle 1.0 "Version 1.0" --push` |
|
|
127
|
+
| Read a version's properties. | `versite props 1.0 --json` |
|
|
128
|
+
| Set a version property. | `versite props 1.0 --set hidden=true --push` |
|
|
129
|
+
| Delete a version property. | `versite props 1.0 --delete hidden --push` |
|
|
130
|
+
| Change the default version. | `versite set-default stable --push` |
|
|
131
|
+
| Delete a version or alias. | `versite delete 1.0 --push` |
|
|
132
|
+
| Delete all registered versions and aliases. | `versite delete --all --push` |
|
|
133
|
+
|
|
134
|
+
`delete --all` preserves other files, including the default redirect, `CNAME`,
|
|
135
|
+
and `.nojekyll`. It succeeds when no versions remain.
|
|
136
|
+
|
|
137
|
+
For all available options, run `versite --help` or `versite COMMAND --help`.
|
|
138
|
+
|
|
139
|
+
## Suppress routine output
|
|
140
|
+
|
|
141
|
+
Place `--quiet` or `-q` before the command name to suppress routine Git messages:
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
versite --quiet props 1.0 channel --json
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Command results remain on standard output, and errors remain on standard error.
|
|
148
|
+
|
|
149
|
+
## Edit version properties
|
|
150
|
+
|
|
151
|
+
Use `retitle` and `props` to update published metadata without rebuilding the
|
|
152
|
+
site. To edit properties during deployment, use the corresponding `--prop-*`
|
|
153
|
+
flags: for example, use `deploy --prop-set` instead of `props --set`.
|
|
154
|
+
The same values and editing rules apply.
|
|
155
|
+
|
|
156
|
+
Store custom metadata, such as support status or release channel, in a version's
|
|
157
|
+
properties. Versite saves properties in `versions.json`; your theme or other
|
|
158
|
+
tools determine how to use them.
|
|
159
|
+
|
|
160
|
+
### Read properties
|
|
161
|
+
|
|
162
|
+
Read all properties for a version:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
versite props 1.0
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
To read one property, pass its path:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
versite props 1.0 channel
|
|
172
|
+
versite props 1.0 metadata.supported
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
For scripts, use `--json` to encode property values as JSON. The `list` command
|
|
176
|
+
outputs JSON by default. Command results go to standard output; Git status
|
|
177
|
+
messages and errors go to standard error, so you can redirect results to a file:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
versite list > versions.json
|
|
181
|
+
versite props 1.0 channel --json > channel.json
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Set properties
|
|
185
|
+
|
|
186
|
+
Use `--set` for JSON values and `--set-string` for literal text:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
versite props 1.0 --set hidden=false --set-string channel=stable --push
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
JSON values can be objects, arrays, strings, numbers, booleans, or `null`.
|
|
193
|
+
For example, store an object in a property named `metadata`:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
versite props 1.0 --set 'metadata={"supported":true,"channel":"stable"}' --push
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Use `--set-string label=true` to store the string `"true"`, or `--set label=true`
|
|
200
|
+
to store the boolean `true`. `--set` preserves properties you don't specify.
|
|
201
|
+
|
|
202
|
+
### Select nested properties
|
|
203
|
+
|
|
204
|
+
Use dots to select object fields and brackets to select array items. Array
|
|
205
|
+
indexes start at `0`; negative indexes count from the end.
|
|
206
|
+
|
|
207
|
+
| Path | Selects |
|
|
208
|
+
| --- | --- |
|
|
209
|
+
| `release.channel` | The `channel` field inside `release`. |
|
|
210
|
+
| `release["support.status"]` | A field literally named `support.status` inside `release`. |
|
|
211
|
+
| `links[0]` | The first item in `links`. |
|
|
212
|
+
| `links[-1]` | The last item in `links`. |
|
|
213
|
+
| `[0].channel` | The `channel` field in the first item when properties is an array. |
|
|
214
|
+
|
|
215
|
+
Field names can also be quoted after a dot, such as `release."support.status"`.
|
|
216
|
+
Quote the complete path or assignment in your shell to preserve brackets and
|
|
217
|
+
embedded quotes:
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
versite props 1.0 --set 'release["support.status"]=true' --push
|
|
221
|
+
versite props 1.0 'release["support.status"]' --json
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
To insert a value at the beginning or end of an array, use `[head]` or `[tail]`:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
versite props 1.0 --set 'links[tail]="/guide/"' --push
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Insertion keywords must be the last step in a setting operation. Use a numeric
|
|
231
|
+
index to read or delete an array item. Missing or `null` containers are created
|
|
232
|
+
as needed when setting values; incompatible types produce an error.
|
|
233
|
+
|
|
234
|
+
### Replace all properties
|
|
235
|
+
|
|
236
|
+
Pass a JSON value to `--set-all`:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
versite props 1.0 --set-all '{"hidden":false,"channel":"stable"}' --push
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
This replaces the entire properties value. If you supply an object, any
|
|
243
|
+
properties omitted from that object are removed. You can also replace the value
|
|
244
|
+
with an array, string, number, boolean, or `null`:
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
versite props 1.0 --set-all '["stable","lts"]' --push
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### Delete properties
|
|
251
|
+
|
|
252
|
+
Delete a property with `--delete`, or clear all properties with `--delete-all`:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
versite props 1.0 --delete hidden --push
|
|
256
|
+
versite props 1.0 --delete-all --push
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Deleting a missing property leaves the other properties unchanged.
|
|
260
|
+
`--delete-all` sets properties to `null`.
|
|
261
|
+
|
|
262
|
+
You can combine editing flags to update several properties in one commit.
|
|
263
|
+
Versite replaces or clears all properties first, deletes individual properties
|
|
264
|
+
next, and sets individual properties last, regardless of flag placement.
|
|
265
|
+
Add `--push` to push that commit to your remote.
|
|
266
|
+
|
|
267
|
+
Use at most one `--set-all` or `--delete-all` per command, and edit each property
|
|
268
|
+
path only once. Use separate commands when changes require a particular sequence.
|
|
269
|
+
|
|
270
|
+
### Load JSON from a file or CI
|
|
271
|
+
|
|
272
|
+
In Bash, use quoted command substitution to read a settings file:
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
versite props 1.0 --set-all "$(cat properties.json)" --push
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
The file must contain valid JSON. To load its contents into one property
|
|
279
|
+
instead, use `--set "metadata=$(cat properties.json)"`.
|
|
280
|
+
|
|
281
|
+
If your CI workflow stores JSON in the `PROPERTIES_JSON` environment variable,
|
|
282
|
+
pass the quoted variable:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
versite props 1.0 --set-all "$PROPERTIES_JSON" --push
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
To generate JSON from other values, use a tool such as `jq`. This example stores
|
|
289
|
+
the value of the `CHANNEL` environment variable as a string:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
versite props 1.0 --set-all "$(jq -n --arg channel "$CHANNEL" \
|
|
293
|
+
'{channel: $channel, supported: true}')" --push
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
Versite validates JSON arguments before updating the version's properties.
|
|
297
|
+
|
|
298
|
+
## Use the GitHub action
|
|
299
|
+
|
|
300
|
+
Use the action after you build your site. This Jekyll workflow builds a version
|
|
301
|
+
and pushes the result to `gh-pages`. Configure your hosting service separately
|
|
302
|
+
to publish the branch contents.
|
|
303
|
+
|
|
304
|
+
```yaml
|
|
305
|
+
name: Site
|
|
306
|
+
|
|
307
|
+
on:
|
|
308
|
+
workflow_dispatch:
|
|
309
|
+
inputs:
|
|
310
|
+
version:
|
|
311
|
+
description: Version identifier to publish
|
|
312
|
+
required: true
|
|
313
|
+
type: string
|
|
314
|
+
|
|
315
|
+
permissions:
|
|
316
|
+
contents: write
|
|
317
|
+
|
|
318
|
+
jobs:
|
|
319
|
+
site:
|
|
320
|
+
runs-on: ubuntu-latest
|
|
321
|
+
steps:
|
|
322
|
+
- uses: actions/checkout@v7
|
|
323
|
+
with:
|
|
324
|
+
fetch-depth: 0
|
|
325
|
+
|
|
326
|
+
- uses: ruby/setup-ruby@v1
|
|
327
|
+
with:
|
|
328
|
+
ruby-version: "3.3"
|
|
329
|
+
bundler-cache: true
|
|
330
|
+
|
|
331
|
+
- name: Build site
|
|
332
|
+
env:
|
|
333
|
+
VERSION: ${{ inputs.version }}
|
|
334
|
+
run: |
|
|
335
|
+
bundle exec jekyll build \
|
|
336
|
+
--destination _site \
|
|
337
|
+
--baseurl "/$VERSION"
|
|
338
|
+
|
|
339
|
+
- uses: PrimerPages/versite@main
|
|
340
|
+
with:
|
|
341
|
+
version: ${{ inputs.version }}
|
|
342
|
+
aliases: latest
|
|
343
|
+
default-to: latest
|
|
344
|
+
site-dir: _site
|
|
345
|
+
branch: gh-pages
|
|
346
|
+
fetch: true
|
|
347
|
+
push: true
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
The example assumes your site is hosted at the domain root. If you host it under
|
|
351
|
+
a repository path, include that path in `--baseurl`, such as
|
|
352
|
+
`"/my-project/$VERSION"`.
|
|
353
|
+
|
|
354
|
+
Use `default-to: latest` to make the site's root URL redirect to the current
|
|
355
|
+
`latest` alias. With `deploy-prefix: docs`, this redirects `docs/` to
|
|
356
|
+
`docs/latest/`. Omit `default-to` to preserve an existing default redirect.
|
|
357
|
+
|
|
358
|
+
Omit `fetch` and `push` to use their values from `versite.yml`. Set either input
|
|
359
|
+
to `true` or `false` to override the configuration.
|
|
360
|
+
See the [action inputs](action.yml) for configuration options.
|
|
361
|
+
|
|
362
|
+
## Advanced
|
|
363
|
+
|
|
364
|
+
### Build for versioned URLs
|
|
365
|
+
|
|
366
|
+
Configure generated links for the location where you publish each version.
|
|
367
|
+
Versite preserves the URLs in your built files.
|
|
368
|
+
|
|
369
|
+
For MkDocs, read the version's published URL from an
|
|
370
|
+
[environment variable](https://www.mkdocs.org/user-guide/configuration/#environment-variables)
|
|
371
|
+
in `mkdocs.yml`:
|
|
372
|
+
|
|
373
|
+
```yaml
|
|
374
|
+
site_url: !ENV VERSITE_SITE_URL
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
Set that variable when you build, then deploy the result:
|
|
378
|
+
|
|
379
|
+
```bash
|
|
380
|
+
VERSION=1.0
|
|
381
|
+
VERSITE_SITE_URL="https://example.com/project/$VERSION/" \
|
|
382
|
+
mkdocs build --clean --site-dir dist/site
|
|
383
|
+
versite deploy "$VERSION" latest --site-dir dist/site --push
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
For Jekyll, set the base path when you build:
|
|
387
|
+
|
|
388
|
+
```bash
|
|
389
|
+
VERSION=1.0
|
|
390
|
+
bundle exec jekyll build --destination dist/site --baseurl "/$VERSION"
|
|
391
|
+
versite deploy "$VERSION" latest --site-dir dist/site --push
|
|
392
|
+
```
|
|
393
|
+
|
|
394
|
+
Include any repository or hosting prefix in the base path. The `deploy_prefix`
|
|
395
|
+
setting controls the directory inside the deployment branch; configure your
|
|
396
|
+
site generator's URLs separately.
|
|
397
|
+
|
|
398
|
+
With `deploy_prefix: docs`, the default redirect lives at `docs/index.html`.
|
|
399
|
+
Running `versite set-default latest` redirects `docs/` to `docs/latest/` and
|
|
400
|
+
leaves the branch's root `index.html` unchanged. Each deployment prefix has
|
|
401
|
+
its own version metadata and default redirect.
|
|
402
|
+
|
|
403
|
+
### Set a default before deployment
|
|
404
|
+
|
|
405
|
+
Use `--allow-undefined` to configure the default redirect before you deploy its
|
|
406
|
+
target version or alias:
|
|
407
|
+
|
|
408
|
+
```bash
|
|
409
|
+
versite set-default latest --allow-undefined --push
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
This creates a redirect to `latest/` without creating a version or alias. The
|
|
413
|
+
destination is available after you deploy a version with the `latest` alias.
|
|
414
|
+
Without `--allow-undefined`, the target must already exist.
|
|
415
|
+
|
|
416
|
+
### Choose an alias mode
|
|
417
|
+
|
|
418
|
+
Set `alias_type` in `versite.yml` to choose how aliases work. Override it with
|
|
419
|
+
`--alias-type` on `deploy` or `alias`, or with the action's `alias-type` input.
|
|
420
|
+
Each deployment recreates all aliases attached to its version using this mode:
|
|
421
|
+
|
|
422
|
+
| Mode | Behavior |
|
|
423
|
+
| --- | --- |
|
|
424
|
+
| `redirect` | Creates HTML redirects to the version. This is the default and works with GitHub Pages. |
|
|
425
|
+
| `copy` | Copies the version's files into each alias directory. |
|
|
426
|
+
| `symlink` | Creates symbolic links. Use this mode only if your host supports them. |
|
|
427
|
+
|
|
428
|
+
### Customize redirects
|
|
429
|
+
|
|
430
|
+
Create an HTML template that uses the Jinja variable `{{ href }}` for the
|
|
431
|
+
redirect destination:
|
|
432
|
+
|
|
433
|
+
```html
|
|
434
|
+
<!doctype html>
|
|
435
|
+
<html lang="en">
|
|
436
|
+
<head>
|
|
437
|
+
<meta charset="utf-8">
|
|
438
|
+
<meta http-equiv="refresh" content="0; url={{ href }}">
|
|
439
|
+
<title>Redirecting</title>
|
|
440
|
+
</head>
|
|
441
|
+
<body>
|
|
442
|
+
<p><a href="{{ href }}">Continue to the documentation</a></p>
|
|
443
|
+
</body>
|
|
444
|
+
</html>
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
Set `redirect_template: redirect.html` in `versite.yml`, or pass
|
|
448
|
+
`--template redirect.html` to `deploy`, `alias`, or `set-default`. The template
|
|
449
|
+
controls the default redirect and aliases that use redirect mode.
|
|
450
|
+
|
|
451
|
+
### Version ordering
|
|
452
|
+
|
|
453
|
+
Version selectors that read `versions.json` use the same order as `versite list`:
|
|
454
|
+
|
|
455
|
+
- Development names such as `dev`, `devel`, and `nightly` appear above numbered versions.
|
|
456
|
+
- Within each group, versions sort from newest to oldest using their version
|
|
457
|
+
identifiers.
|
|
458
|
+
- Comparisons use the version identifier as written, including any `v` prefix.
|
|
459
|
+
Use a consistent prefix to keep numbered versions in the order you expect.
|
|
460
|
+
|
|
461
|
+
Changing a display title or alias doesn't change the sort order. Existing
|
|
462
|
+
entries are sorted the next time you deploy or update version metadata.
|
|
463
|
+
|
|
464
|
+
### Synchronize the deployment branch
|
|
465
|
+
|
|
466
|
+
By default, versite checks the local deployment branch against the cached remote
|
|
467
|
+
tracking branch without contacting the remote. Use `--fetch` to refresh that
|
|
468
|
+
tracking branch before checking it, and `--push` to publish the resulting commits:
|
|
469
|
+
|
|
470
|
+
```bash
|
|
471
|
+
versite deploy 2.0 latest --site-dir _site --fetch --push
|
|
472
|
+
```
|
|
473
|
+
|
|
474
|
+
The flags are independent. `--fetch` alone updates remote tracking information
|
|
475
|
+
and prepares the local deployment. `--push` alone publishes without fetching
|
|
476
|
+
first. To enable either behavior by default, set `fetch: true` or `push: true`
|
|
477
|
+
in `versite.yml`. Use `--no-fetch` or `--no-push` to override an enabled default.
|
|
478
|
+
The GitHub Action accepts matching `fetch` and `push` inputs.
|
|
479
|
+
|
|
480
|
+
If the local deployment branch is behind the tracking branch, versite advances
|
|
481
|
+
it with a fast-forward. Local commits are preserved. If the histories have
|
|
482
|
+
diverged, resolve the divergence before deploying again. An explicit fetch
|
|
483
|
+
failure stops the command, except when the remote deployment branch doesn't
|
|
484
|
+
exist yet.
|
|
485
|
+
|
|
486
|
+
Use `--ignore-remote-status` to skip synchronization and divergence checks. It
|
|
487
|
+
doesn't skip an explicit `--fetch`, force a push, or resolve diverged histories.
|
|
488
|
+
|
|
489
|
+
### Publish with GitHub Pages
|
|
490
|
+
|
|
491
|
+
Versite updates the deployment branch. Choose how GitHub Pages publishes its
|
|
492
|
+
contents:
|
|
493
|
+
|
|
494
|
+
- For branch publishing, select `gh-pages` as the source in your repository's
|
|
495
|
+
Pages settings. Pushes authenticated with `GITHUB_TOKEN` don't trigger Pages
|
|
496
|
+
builds; use a suitable personal access token or GitHub App token if you need
|
|
497
|
+
the push to trigger publishing.
|
|
498
|
+
- For Actions publishing, package the complete updated deployment branch with
|
|
499
|
+
`actions/upload-pages-artifact` and publish it with `actions/deploy-pages`.
|
|
500
|
+
Include every version, the aliases, and `versions.json` in the artifact.
|
|
501
|
+
|
|
502
|
+
### Enable shell completion
|
|
503
|
+
|
|
504
|
+
Versite can complete command names, options, alias modes, and file or directory
|
|
505
|
+
paths. Enter version identifiers and aliases manually.
|
|
506
|
+
|
|
507
|
+
Before configuring completion, add versite to your `PATH`. Place the completion
|
|
508
|
+
command after any `PATH` configuration in your shell's configuration file.
|
|
509
|
+
After saving your changes, start a new shell to enable completion.
|
|
510
|
+
|
|
511
|
+
Each new shell loads completion from the installed version of versite. You don't
|
|
512
|
+
need to regenerate a script after upgrading.
|
|
513
|
+
|
|
514
|
+
#### Bash
|
|
515
|
+
|
|
516
|
+
Add this line to `~/.bashrc`:
|
|
517
|
+
|
|
518
|
+
```bash
|
|
519
|
+
eval "$(_VERSITE_COMPLETE=bash_source versite)"
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
#### Zsh
|
|
523
|
+
|
|
524
|
+
Add this line to `~/.zshrc`:
|
|
525
|
+
|
|
526
|
+
```zsh
|
|
527
|
+
eval "$(_VERSITE_COMPLETE=zsh_source versite)"
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
#### Fish
|
|
531
|
+
|
|
532
|
+
Add this line to `~/.config/fish/config.fish`:
|
|
533
|
+
|
|
534
|
+
```fish
|
|
535
|
+
_VERSITE_COMPLETE=fish_source versite | source
|
|
536
|
+
```
|
|
537
|
+
|
|
538
|
+
## Contribute
|
|
539
|
+
|
|
540
|
+
For development setup, tests, and theme integration details, see
|
|
541
|
+
[Contribute to versite](CONTRIBUTING.md).
|