diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2a2aaa4..dd23fa4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,15 +14,29 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Verify version match + - name: Sync module.json version from tag run: | - TAG_VERSION="${GITHUB_REF_NAME#v}" - MODULE_VERSION=$(grep '"version"' src/module.json | head -1 | sed 's/.*"version"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/') - if [ "$TAG_VERSION" != "$MODULE_VERSION" ]; then - echo "ERROR: Tag version ($TAG_VERSION) does not match module.json version ($MODULE_VERSION)" - exit 1 - fi - echo "Version check passed: $TAG_VERSION" + VERSION="${GITHUB_REF_NAME#v}" + # Write the tag version into every module.json the build / Module + # Store might read so the tag is the single source of truth. + # Previously this workflow only *verified* src/module.json matched + # the tag; the build then copied the *root* module.json into the + # tarball, which could (and did) lag behind src/module.json and + # cause the Module Store to advertise the update forever. + python3 - "$VERSION" <<'PYEOF' + import json, sys, pathlib + version = sys.argv[1] + for p in ("module.json", "src/module.json"): + path = pathlib.Path(p) + if not path.exists(): + continue + data = json.loads(path.read_text()) + data["version"] = version + # Preserve the indent style each file already uses. + indent = 4 if p == "module.json" else 4 + path.write_text(json.dumps(data, indent=indent) + "\n") + print(f" {p}: version -> {version}") + PYEOF - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -54,7 +68,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Commit release.json + - name: Commit release.json + module.json sync run: | VERSION="${GITHUB_REF_NAME#v}" BRANCH=$(git remote show origin | sed -n '/HEAD branch/s/.*: //p') @@ -62,12 +76,30 @@ jobs: git checkout -f "$BRANCH" git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" + # Apply the same module.json sync to the default branch so the + # tree stays consistent with what was tagged (and so the next + # author bumping versions starts from the right place). + python3 - "$VERSION" <<'PYEOF' + import json, sys, pathlib + version = sys.argv[1] + for p in ("module.json", "src/module.json"): + path = pathlib.Path(p) + if not path.exists(): + continue + data = json.loads(path.read_text()) + data["version"] = version + path.write_text(json.dumps(data, indent=4) + "\n") + PYEOF cat > release.json << EOF { "version": "${VERSION}", "download_url": "https://github.com/${{ github.repository }}/releases/download/${{ github.ref_name }}/dissolver-module.tar.gz" } EOF - git add release.json - git commit -m "ci: update release.json for ${{ github.ref_name }}" || echo "No changes to commit" - git push origin "$BRANCH" + git add release.json module.json src/module.json + if git diff --cached --quiet; then + echo "No changes to commit" + else + git commit -m "ci: sync release.json + module.json for ${{ github.ref_name }}" + git push origin "$BRANCH" + fi diff --git a/module.json b/module.json index aa15718..f171f4e 100644 --- a/module.json +++ b/module.json @@ -2,7 +2,7 @@ "id": "dissolver", "name": "Dissolver", "abbrev": "DSLVR", - "version": "0.2.2", + "version": "0.2.3", "description": "Spectral smearing pad generator — kills transients, preserves harmonic content, blends temporality into evolving pads.", "author": "fillioning", "dsp": "dissolver.so",