Skip to content

Update index

Update index #175

Workflow file for this run

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/install-jq-action@v2.0.2
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