diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..35b6795 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,27 @@ +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: denoland/setup-deno@v1 + with: + deno-version: v1.x + - uses: eifinger/setup-rye@v3 + with: + version: latest + - run: | + rye build + rye publish + - run: deno run -A 'npm:changelogithub@0.13' + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} diff --git a/pyproject.toml b/pyproject.toml index f993706..65b0143 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,3 +46,6 @@ select = [ [tool.ruff.lint.per-file-ignores] "tests/*.py" = ["D", "S"] + +[tool.hatch.build.hooks.custom] +path = "scripts/hatch_build.py" diff --git a/scripts/hatch_build.py b/scripts/hatch_build.py new file mode 100644 index 0000000..9923002 --- /dev/null +++ b/scripts/hatch_build.py @@ -0,0 +1,19 @@ +"""A Hatchling plugin to build the quak frontend.""" + +import pathlib +import subprocess + +from hatchling.builders.hooks.plugin.interface import BuildHookInterface + +ROOT = pathlib.Path(__file__).parent / ".." + + +class QuakBuildHook(BuildHookInterface): + """Hatchling plugin to build the quak frontend.""" + + PLUGIN_NAME = "quak" + + def initialize(self, version: str, build_data: dict) -> None: + """Initialize the plugin.""" + if not (ROOT / "src/quak/widget.js").exists(): + subprocess.check_call(["deno", "task", "build"], cwd=ROOT)