Skip to content

Commit ab0a368

Browse files
committed
ci/docs: use version-info.toml
1 parent 6a054de commit ab0a368

File tree

1 file changed

+60
-33
lines changed

1 file changed

+60
-33
lines changed

.github/workflows/website.yml

Lines changed: 60 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,72 @@ concurrency:
1313
cancel-in-progress: true
1414

1515
jobs:
16+
prepare:
17+
name: Version info
18+
runs-on: ubuntu-24.04-arm
19+
20+
outputs:
21+
matrix: ${{ steps.matrix.outputs.result }}
22+
versions: ${{ steps.versions.outputs.result }}
23+
24+
steps:
25+
- name: Checkout version-info
26+
uses: actions/checkout@v4
27+
with:
28+
sparse-checkout: version-info.toml
29+
sparse-checkout-cone-mode: false
30+
31+
- name: Produce build matrix
32+
id: matrix
33+
uses: mikefarah/yq@master
34+
with:
35+
cmd: |
36+
yq --no-colors --output-format=json '
37+
[
38+
.versions
39+
| to_entries
40+
| reverse
41+
| .[]
42+
| {
43+
"ref": .value.branch,
44+
"name": .key,
45+
"base-href": "/nixvim/"
46+
}
47+
| select(.ref != "main").sub-path = .name
48+
| select(.ref != "main").base-href += .name + "/"
49+
]
50+
' version-info.toml
51+
52+
- name: Produce "other versions" array
53+
id: versions
54+
uses: mikefarah/yq@master
55+
with:
56+
cmd: |
57+
yq --no-colors --output-format=json '
58+
[
59+
.versions
60+
| to_entries
61+
| reverse
62+
| .[]
63+
| {
64+
"branch": .value.branch,
65+
"nixpkgsBranch": .value.channel,
66+
"baseHref": "/nixvim/\(.key)/"
67+
}
68+
| select(.branch == "main").baseHref = "/nixvim/"
69+
]
70+
' version-info.toml
71+
# TODO: add channel status
72+
1673
build:
1774
name: Build ${{ matrix.name }}
1875
runs-on: ubuntu-latest
76+
needs: prepare
1977

2078
strategy:
2179
fail-fast: true
2280
matrix:
23-
# TODO: generate matrix from version-info.toml
24-
include:
25-
- name: unstable
26-
ref: main
27-
sub-path: ""
28-
base-href: /nixvim/
29-
- name: "25.05"
30-
ref: nixos-25.05
31-
sub-path: "25.05"
32-
base-href: /nixvim/25.05/
33-
- name: "24.11"
34-
ref: nixos-24.11
35-
sub-path: "24.11"
36-
base-href: /nixvim/24.11/
81+
include: ${{ fromJSON(needs.prepare.outputs.matrix) }}
3782

3883
steps:
3984
- name: Install nix
@@ -57,25 +102,7 @@ jobs:
57102
artifact-name: ${{ matrix.name }}-docs
58103
sub-path: ${{ matrix.sub-path }}
59104
base-href: ${{ matrix.base-href }}
60-
# TODO: generate JSON from version-info.toml
61-
versions: >
62-
[
63-
{
64-
"branch": "main",
65-
"nixpkgsBranch": "nixos-unstable",
66-
"baseHref": "/nixvim/"
67-
},
68-
{
69-
"branch": "nixos-25.05",
70-
"nixpkgsBranch": "nixos-25.05",
71-
"baseHref": "/nixvim/25.05/"
72-
},
73-
{
74-
"branch": "nixos-24.11",
75-
"nixpkgsBranch": "nixos-24.11",
76-
"baseHref": "/nixvim/24.11/"
77-
}
78-
]
105+
versions: ${{ needs.prepare.outputs.versions }}
79106

80107
combine:
81108
name: Combine builds

0 commit comments

Comments
 (0)