Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add json index of files to CI uploads #24097

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/ci_build_major_branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,12 @@ jobs:
run: |
python3 -m pip install -r ./util/ci/requirements.txt
./util/ci/index_generator.py > index.html
./util/ci/firmware_list_generator.py > firmware_list.json

- name: Upload to https://ci.qmk.fm/${{ inputs.branch || github.ref_name }}/${{ github.sha }}
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete --exclude '*' --include 'index.html' --include '*.hex' --include '*.bin' --include '*.uf2'
args: --acl public-read --follow-symlinks --delete --exclude '*' --include 'index.html' --include 'firmware_list.json' --include '*.hex' --include '*.bin' --include '*.uf2'
env:
AWS_S3_BUCKET: ${{ vars.CI_QMK_FM_SPACES_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_QMK_FM_SPACES_KEY }}
Expand All @@ -112,7 +113,7 @@ jobs:
- name: Upload to https://ci.qmk.fm/${{ inputs.branch || github.ref_name }}/latest
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks --delete --exclude '*' --include 'index.html' --include '*.hex' --include '*.bin' --include '*.uf2'
args: --acl public-read --follow-symlinks --delete --exclude '*' --include 'index.html' --include 'firmware_list.json' --include '*.hex' --include '*.bin' --include '*.uf2'
env:
AWS_S3_BUCKET: ${{ vars.CI_QMK_FM_SPACES_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_QMK_FM_SPACES_KEY }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
*.stackdump
*.sym
index.html
firmware_list.json

# QMK-specific
api_data/v1
Expand Down
26 changes: 26 additions & 0 deletions util/ci/firmware_list_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import os
import json
from pathlib import Path
from time import gmtime, strftime

DATETIME_FORMAT = '%Y-%m-%d %H:%M:%S %Z'

def current_datetime():
return strftime(DATETIME_FORMAT, gmtime())


qmk_firmware_dir = Path(os.path.realpath(__file__)).parents[2]

binaries = []
binaries.extend(qmk_firmware_dir.glob("*.bin"))
binaries.extend(qmk_firmware_dir.glob("*.hex"))
binaries.extend(qmk_firmware_dir.glob("*.uf2"))
binaries = list(sorted(binaries))

data = []
for binary in binaries:
data.append(binary.name)

keyboard_all_json = json.dumps({'last_updated': current_datetime(), 'files': data}, separators=(',', ':'))

print(keyboard_all_json)
3 changes: 2 additions & 1 deletion util/ci/templates/index.html.j2
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="icon" href="https://qmk.fm/logo.png" />
<style type="text/css">
{{ ansi2html_styles }}

Expand Down Expand Up @@ -66,7 +67,7 @@
<div style="float: left">
<div class="container">
<div style="display: table-cell; vertical-align: middle;">
<a href="https://qmk.fm/"><img src="https://qmk.fm/assets/images/badge-community-dark.svg" style="width: 30em;" /></a>
<a href="https://qmk.fm/"><img src="https://qmk.fm/badge-community-dark.svg" style="width: 30em;" /></a>
</div>
<div class="header-container">
<div>
Expand Down
Loading