From 85f936e590be3782edb245a9d6cc393a3e839da6 Mon Sep 17 00:00:00 2001 From: Denis Ah-Kang Date: Mon, 2 Mar 2026 11:05:31 +0400 Subject: [PATCH 1/4] helper to generate auto publication workflows --- .github/auto-publish-template.yml | 34 ++++++++ .github/generate-auto-publish-workflows.py | 94 ++++++++++++++++++++++ 2 files changed, 128 insertions(+) create mode 100644 .github/auto-publish-template.yml create mode 100644 .github/generate-auto-publish-workflows.py diff --git a/.github/auto-publish-template.yml b/.github/auto-publish-template.yml new file mode 100644 index 00000000000..478ded97767 --- /dev/null +++ b/.github/auto-publish-template.yml @@ -0,0 +1,34 @@ +###################################################################### +# This is the template used to generate auto-publication workflows for +# the different documents in the repository. Check generate script for +# details. Edit this file and run the script again to update the +# workflows. +###################################################################### + +name: Publish {{shortname}} on /TR + +on: + pull_request: + push: + branches: [main] + paths: + - "{{shortname}}/**" + workflow_dispatch: + +jobs: + publish-TR-{{shortname}}: + name: Publish {{shortname}} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: w3c/spec-prod@v2 + with: + TOOLCHAIN: bikeshed + SOURCE: {{shortname}}/Overview.bs + DESTINATION: {{shortname}}/index.html + BUILD_FAIL_ON: warning + VALIDATE_MARKUP: false + W3C_ECHIDNA_TOKEN: ${{ secrets.{{tokenName}} }} + W3C_WG_DECISION_URL: https://www.w3.org/2025/08/21-css-minutes.html#fc30 + W3C_BUILD_OVERRIDE: | + status: {{publicationStatus}} diff --git a/.github/generate-auto-publish-workflows.py b/.github/generate-auto-publish-workflows.py new file mode 100644 index 00000000000..df6399fd23f --- /dev/null +++ b/.github/generate-auto-publish-workflows.py @@ -0,0 +1,94 @@ +#!/usr/bin/env python3 +""" +Script to generate auto publication workflows for given specs +""" + +import re +from pathlib import Path + +# ----------------------------------------------------------------------------- +# List of properties that can appear to describe a spec. +# ----------------------------------------------------------------------------- + +PROPERTIES = [ + "shortname", + "publicationStatus", + "tokenName", +] + +# ----------------------------------------------------------------------------- +# List of specs for which an auto-publish script needs to be created. +# ----------------------------------------------------------------------------- + +SPECS = [ + { + "shortname": "css-color-4", + "publicationStatus": "CRD", + }, + { + "shortname": "css-color-5", + "publicationStatus": "WD", + }, + { + "shortname": "css-fonts-4", + "publicationStatus": "WD", + }, +] + +# ----------------------------------------------------------------------------- +# Main +# ----------------------------------------------------------------------------- + +def main(): + script_path = Path(__file__).parent + template_path = script_path / "auto-publish-template.yml" + workflows_dir = script_path / "workflows" + + workflows_dir.mkdir(parents=True, exist_ok=True) + + template = template_path.read_text(encoding="utf-8") + + # Replace the large comment header block (#####...#####) + template = re.sub( + r"#{5,}.*?#{5,}", + """###################################################################### +# IMPORTANT: Do not edit this file directly! +# +# This workflow was automatically generated through the +# generate-auto-publish-workflows.py script. To update the workflow, +# make changes to the template file and run the script again. +######################################################################""", + template, + flags=re.S, + ) + + for spec in SPECS: + spec = spec.copy() + + # Derive shortname from source if not provided + if "shortname" not in spec or not spec["shortname"]: + spec["shortname"] = spec["source"].split(".")[0].replace("_", "-") + + # Derive tokenName if not provided + if "tokenName" not in spec or not spec["tokenName"]: + token = ( + spec["shortname"] + .upper() + .replace("-", "_") + ) + spec["tokenName"] = f"TR_TOKEN_{token}" + + # Apply template substitutions + content = template + for prop in PROPERTIES: + value = spec.get(prop, "") + content = content.replace(f"{{{{{prop}}}}}", value) + + # Write workflow file + filename = workflows_dir / f"{spec['shortname']}.yml" + filename.write_text(content, encoding="utf-8") + print(f"Generated {filename}") + + +if __name__ == "__main__": + main() From 5c5d9a014e86f429aace71cf0a3f2a916126d204 Mon Sep 17 00:00:00 2001 From: Denis Ah-Kang Date: Mon, 2 Mar 2026 13:04:17 +0400 Subject: [PATCH 2/4] don't trigger action on PR --- .github/auto-publish-template.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/auto-publish-template.yml b/.github/auto-publish-template.yml index 478ded97767..c123ddbbbed 100644 --- a/.github/auto-publish-template.yml +++ b/.github/auto-publish-template.yml @@ -8,7 +8,6 @@ name: Publish {{shortname}} on /TR on: - pull_request: push: branches: [main] paths: From 8b42f744aa68b38f05bef1a69225641ee8341ef1 Mon Sep 17 00:00:00 2001 From: Denis Ah-Kang <1696128+deniak@users.noreply.github.com> Date: Tue, 3 Mar 2026 15:07:14 +0400 Subject: [PATCH 3/4] Apply suggestion from @tidoust MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: François Daoust --- .github/auto-publish-template.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/auto-publish-template.yml b/.github/auto-publish-template.yml index c123ddbbbed..2f31ebe060a 100644 --- a/.github/auto-publish-template.yml +++ b/.github/auto-publish-template.yml @@ -8,6 +8,9 @@ name: Publish {{shortname}} on /TR on: + pull_request: + paths: + - "{{shortname}}/**" push: branches: [main] paths: From 35ebfb4a8243f8c59d1f0dae0492d1edae0f86dc Mon Sep 17 00:00:00 2001 From: Chris Lilley Date: Tue, 3 Mar 2026 15:27:06 -0500 Subject: [PATCH 4/4] Update .github/generate-auto-publish-workflows.py --- .github/generate-auto-publish-workflows.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/generate-auto-publish-workflows.py b/.github/generate-auto-publish-workflows.py index df6399fd23f..f02072760df 100644 --- a/.github/generate-auto-publish-workflows.py +++ b/.github/generate-auto-publish-workflows.py @@ -30,7 +30,7 @@ "publicationStatus": "WD", }, { - "shortname": "css-fonts-4", + "shortname": "css-fonts-5", "publicationStatus": "WD", }, ]