Skip to content

Commit d9c0b04

Browse files
committed
chore: automate releases procedure
1 parent 750c298 commit d9c0b04

6 files changed

Lines changed: 60 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version_name:
7+
description: 'User facing version name (eg: 0.3.0)'
8+
type: string
9+
required: true
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
env:
15+
RELEASE_VERSION: 'v${{ github.event.inputs.version_name }}'
16+
steps:
17+
- uses: actions/checkout@v4
18+
19+
- name: Update docs
20+
run: make release
21+
22+
- name: Commit changes
23+
uses: EndBug/add-and-commit@v9
24+
with:
25+
message: 'chore: v${{ github.event.inputs.version_name }} release'
26+
tag: 'v${{ github.event.inputs.version_name }} --force'
27+
28+
- name: Create github release
29+
uses: softprops/action-gh-release@v2
30+
with:
31+
name: 'v${{ github.event.inputs.version_name }}'
32+
body: ''
33+
tag_name: 'v${{ github.event.inputs.version_name }}'
34+
prerelease: false
35+
draft: true

CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,11 @@ would be replaced by the generated default configuration, but
6464
is replaced by the contents of the `docgen/shared/keymaps.lua` file.\
6565
The indentation of the placeholder has to be a multiple of 4 spaces
6666
and will be applied to the replacement file.
67+
68+
## Releases
69+
__Manual steps:__
70+
1. Update changelog and add migration guide
71+
2. Run github `Release` action and input new version
72+
2. Verify release
73+
- Publish draft-release
74+
- update `stable` tag

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,9 @@ test:
1010
doc:
1111
nvim -l docgen/gen_doc.lua
1212

13+
.PHONY: release
14+
release:
15+
@test $${RELEASE_VERSION?Please set environment variable RELEASE_VERSION}
16+
echo "${RELEASE_VERSION}" > docgen/shared/stable.txt
17+
nvim -l docgen/gen_doc.lua
18+
mv docgen/wiki/Documentation-unstable.md "docgen/wiki/Documentation-${RELEASE_VERSION}.md"

docgen/gen_doc.lua

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@ exec nvim -l "$0" "$@"
55

66
local config = require("lua.crates.config.init")
77
local highlight = require("lua.crates.highlight")
8-
local version = "unstable"
8+
local version = vim.env["RELEASE_VERSION"] or "unstable"
9+
local stable_version = nil
10+
do
11+
local file = io.open("docgen/shared/stable.txt")
12+
stable_version = vim.trim(file:read("*a"))
13+
file:close()
14+
end
915

1016
---@param line_iter fun(): string?
1117
---@param line string
@@ -399,6 +405,7 @@ local function gen_vim_doc()
399405
else
400406
---@type string
401407
l = l:gsub("<VERSION>", version)
408+
l = l:gsub("<STABLE>", stable_version)
402409
table.insert(lines, l)
403410
end
404411
end
@@ -433,6 +440,7 @@ local function gen_markdown(inpath, outpath)
433440
end
434441
else
435442
l = l:gsub("<VERSION>", version)
443+
l = l:gsub("<STABLE>", stable_version)
436444
table.insert(lines, l)
437445
end
438446
end

docgen/shared/stable.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
v0.6.0

docgen/templates/README.md.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ lua require('crates').setup()
6969
</details>
7070

7171
## [Documentation](https://github.com/Saecki/crates.nvim/wiki)
72-
- [Stable](https://github.com/Saecki/crates.nvim/wiki/Documentation-v0.6.0)
72+
- [Stable](https://github.com/Saecki/crates.nvim/wiki/Documentation-<STABLE>)
7373
- [Unstable](https://github.com/Saecki/crates.nvim/wiki/Documentation-unstable)
7474

7575
## Related projects

0 commit comments

Comments
 (0)