Merge pull request #71 from NixOS/joerg-ci

fixup update-extension jobname
This commit is contained in:
Jörg Thalheim 2024-04-19 09:30:44 +02:00 committed by GitHub
commit 1460cc83e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 17 additions and 12 deletions

View File

@ -3,9 +3,12 @@ on:
repository_dispatch: repository_dispatch:
workflow_dispatch: workflow_dispatch:
schedule: schedule:
- cron: '51 2 * * *' - cron: "51 2 * * *"
permissions:
pull-requests: write
contents: write
jobs: jobs:
update-submodules: update-extensions:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
@ -15,8 +18,10 @@ jobs:
with: with:
nix_path: nixpkgs=channel:nixos-unstable nix_path: nixpkgs=channel:nixos-unstable
- run: ./modules/nixos-wiki/update-extensions.py ./modules/nixos-wiki/extensions.json - run: ./modules/nixos-wiki/update-extensions.py ./modules/nixos-wiki/extensions.json
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Pull Request - name: Create Pull Request
uses: peter-evans/create-pull-request@v6 uses: peter-evans/create-pull-request@v6
with: with:
title: Update zsh modules title: Update mediawiki extensions
labels: merge-queue labels: merge-queue

View File

@ -1,4 +1,4 @@
{ fetchurl }: { { fetchzip }: {
"MobileFrontend" = fetchurl { url = "https://github.com/NixOS/nixos-wiki-infra/releases/download/MobileFrontend-REL1_41-7e9d1d4.tar.gz/MobileFrontend-REL1_41-7e9d1d4.tar.gz"; sha256 = "1j9b2f5kxv68yl5652pqqfgchdkcc7p7j0afv2f3i4v6yz9ajr1n"; }; "MobileFrontend" = fetchzip { url = "https://github.com/NixOS/nixos-wiki-infra/releases/download/MobileFrontend-REL1_41-7e9d1d4.tar.gz/MobileFrontend-REL1_41-7e9d1d4.tar.gz"; sha256 = "0qk38j2mj9mny2qrzc4y56ng06mks3isz8gk90rgaw6ikcxg5dmj"; };
"DarkMode" = fetchurl { url = "https://github.com/NixOS/nixos-wiki-infra/releases/download/DarkMode-REL1_41-b2fefd2.tar.gz/DarkMode-REL1_41-b2fefd2.tar.gz"; sha256 = "1inbbqd25qacxmxjxl7rx153rapgk61433cs49cjmwcdx62w4vsj"; }; "DarkMode" = fetchzip { url = "https://github.com/NixOS/nixos-wiki-infra/releases/download/DarkMode-REL1_41-b2fefd2.tar.gz/DarkMode-REL1_41-b2fefd2.tar.gz"; sha256 = "0v3jyd2da18mbf0kn4zafw7rpj8awsiljy9jfhabric9k09g57y3"; };
} }

View File

@ -67,17 +67,17 @@ def mirror_extension(extension_name: str, mediawiki_version: str) -> Extension:
with TemporaryDirectory() as tmpdir: with TemporaryDirectory() as tmpdir:
download_file(download_url.geturl(), f"{tmpdir}/{base_name}") download_file(download_url.geturl(), f"{tmpdir}/{base_name}")
run(["gh", "release", "upload", base_name, f"{tmpdir}/{base_name}"]) run(["gh", "release", "upload", base_name, f"{tmpdir}/{base_name}"])
hash = run(["nix-prefetch-url", mirror_url], stdout=subprocess.PIPE).stdout.strip() hash = run(["nix-prefetch-url", "--unpack", mirror_url], stdout=subprocess.PIPE).stdout.strip()
return Extension(name=extension_name, hash=hash, url=mirror_url) return Extension(name=extension_name, hash=hash, url=mirror_url)
def write_nix_file(file: IO[str], mirrored_extensions: list[Extension]) -> None: def write_nix_file(file: IO[str], mirrored_extensions: list[Extension]) -> None:
file.write("{ fetchurl }: {\n") file.write("{ fetchzip }: {\n")
for extension in mirrored_extensions: for extension in mirrored_extensions:
file.write( file.write(
f' "{extension.name}" = fetchurl {{ url = "{extension.url}"; sha256 = "{extension.hash}"; }};\n' f' "{extension.name}" = fetchzip {{ url = "{extension.url}"; sha256 = "{extension.hash}"; }};\n'
) )
file.write("}") file.write("}\n")
def get_mediawiki_version(mediawiki_version: str | None = None) -> str: def get_mediawiki_version(mediawiki_version: str | None = None) -> str: