From 25b461e01286c0b4c7c52adcaa08ebef3f74e1e3 Mon Sep 17 00:00:00 2001 From: Andreas Brett Date: Wed, 1 Jan 2025 15:33:03 +0000 Subject: [PATCH] use CI/CD pipeline to create dropdown list --- .github/workflows/gh-pages.yml | 93 +++++++++++++++++++++++++++++++--- static/index.html | 47 +++-------------- 2 files changed, 95 insertions(+), 45 deletions(-) diff --git a/.github/workflows/gh-pages.yml b/.github/workflows/gh-pages.yml index 3bc88ef..f10e169 100644 --- a/.github/workflows/gh-pages.yml +++ b/.github/workflows/gh-pages.yml @@ -7,12 +7,98 @@ on: paths: - static/** - .github/workflows/gh-pages.yml + release: + types: + - published + - unpublished + +permissions: + contents: read + pages: write + id-token: write concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: + build: + name: Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4.2.2 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install requests + run: | + python -m pip install --upgrade pip + pip install requests + + - name: Fetch releases and update HTML + shell: python + run: | + import datetime + import os + import requests + import re + + repo = os.getenv('GITHUB_REPOSITORY') + event_name = os.getenv('GITHUB_EVENT_NAME', 'unknown') + run_id = os.getenv('GITHUB_RUN_ID', 'unknown') + ref = os.getenv('GITHUB_REF', 'unknown') + timestamp = datetime.datetime.now().isoformat() + + run_url = f"https://github.com/{repo}/actions/runs/{run_id}" + api_url = f'https://api.github.com/repos/{repo}/releases' + + response = requests.get(api_url) + releases = response.json() + + # create