Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 44 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -54,20 +68,38 @@ 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')
git fetch origin "$BRANCH"
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
2 changes: 1 addition & 1 deletion module.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down