From 75a45d0c36eacca4190eb918272e881528d2d5eb Mon Sep 17 00:00:00 2001 From: yasuo Date: Mon, 23 Mar 2026 22:43:14 +0900 Subject: [PATCH] Fix archive --- .github/workflows/release.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a50d4ac..2deea0e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,12 +22,16 @@ jobs: include: - os: macos-15-intel asset_suffix: macos-15-intel + archive_ext: tar.gz - os: macos-latest asset_suffix: macos-latest + archive_ext: tar.gz - os: ubuntu-latest asset_suffix: ubuntu-latest + archive_ext: tar.gz - os: windows-latest asset_suffix: windows-latest + archive_ext: zip steps: - name: Checkout @@ -180,6 +184,35 @@ jobs: -exec cp {} "$package_root/licenses/qret/" \; find "$PWD/.newsynth/license" -mindepth 1 -maxdepth 1 -type f -exec cp {} "$package_root/licenses/newsynth/" \; + python - <<'PY' + import os + import tarfile + import zipfile + from pathlib import Path + + dist = Path("dist") + root = dist / os.environ["ROOT_NAME"] + archive_path = dist / os.environ["ARCHIVE_NAME"] + + if archive_path.suffix == ".zip": + with zipfile.ZipFile(archive_path, "w", zipfile.ZIP_DEFLATED) as zf: + for path in root.rglob("*"): + if path.is_file(): + zf.write(path, path.relative_to(dist).as_posix()) + else: + with tarfile.open(archive_path, "w:gz") as tf: + tf.add(root, arcname=root.name) + PY + env: + ROOT_NAME: qret-${{ matrix.asset_suffix }} + ARCHIVE_NAME: qret-${{ matrix.asset_suffix }}.${{ matrix.archive_ext }} + + - name: Place archive inside artifact directory + shell: bash + run: | + root="qret-${{ matrix.asset_suffix }}" + mv "dist/$root.${{ matrix.archive_ext }}" "dist/$root/" + - name: Upload qret artifact uses: actions/upload-artifact@v4 with: