-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (61 loc) · 2.36 KB
/
update-index.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Update index
on:
workflow_dispatch:
push:
branches:
- main
# mutex
concurrency:
group: update-index
cancel-in-progress: false
jobs:
create-index:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ github.token }}
steps:
- name: Install jq
uses: dcarbone/[email protected]
with:
force: true
- name: Create index
run: |
set -euxo pipefail
gh api --paginate repos/leanprover/lean4/releases > releases
gh api --paginate repos/leanprover/lean4-nightly/releases > releases-nightly
mkdir output
# version 1, all in one file.
jq --compact-output --slurp '
def preprocess: map(pick(.name, .created_at, (.assets | .[] | .name, .browser_download_url)));
{version: "1", stable: .[0] | map(select(.prerelease | not)) | preprocess, beta: .[0] | map(select(.prerelease)) | preprocess, nightly: .[1] | preprocess}' \
releases releases-nightly > output/index.json
# version 2, one file per channel (for smaller stable channel)
jq --compact-output '
def preprocess: map(pick(.name, .created_at, (.assets | .[] | .name, .browser_download_url)));
{version: "2", releases: . | map(select(.prerelease | not)) | preprocess}' \
< releases > output/stable.json
jq --compact-output '
def preprocess: map(pick(.name, .created_at, (.assets | .[] | .name, .browser_download_url)));
{version: "2", releases: . | map(select(.prerelease)) | preprocess}' \
< releases > output/beta.json
jq --compact-output '
def preprocess: map(pick(.name, .created_at, (.assets | .[] | .name, .browser_download_url)));
{version: "2", releases: . | preprocess}' \
< releases-nightly > output/nightly.json
- name: Create artifact
uses: actions/upload-pages-artifact@v2
with:
path: output
deploy:
needs: create-index
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2