Skip to content

Local video editor for coding agents: 42 FFmpeg tools with a machine-readable contract and an MCP server, for Claude Code, Cursor and Codex. Cut, captions, reframe, loudness, platform exports. No cloud, no API keys.

Fully automate releases: auto-tag + GitHub Release + npm publish on main push (#127)

Shogo Kajiyamad50d49256430
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c7abcc0..96ed45c 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -1,19 +1,28 @@
name: release
-# Publishes a GitHub Release automatically whenever a version tag (v*, matching
-# package.json's version) is pushed. This does not push tags itself -- tag
-# creation stays a manual, deliberate act (see CHANGELOG.md / README's
-# "Development" -> "Releasing" section) -- it only automates the release-notes
-# step once a tag exists, so a release isn't a manual multi-click chore in the
-# GitHub UI.
+# Fully automated release: on every push to main, if package.json's current
+# version has no matching vX.Y.Z tag yet, this creates that tag, publishes a
+# GitHub Release (notes taken from CHANGELOG.md's matching section) and
+# publishes to npm -- all in one job. Bumping package.json's version (and
+# writing the matching CHANGELOG.md section) stays a deliberate, manual part
+# of each PR: this workflow only reacts to that bump already having landed on
+# main, it never chooses a version number itself. A push to main whose
+# version is already tagged (most pushes, since not every PR bumps the
+# version) is a no-op: every step below is skipped.
+#
+# This runs as one job triggered directly by the push to main, not chained
+# through a separate tag-push trigger, because a tag pushed by the built-in
+# GITHUB_TOKEN does not itself trigger another workflow run (a deliberate
+# GitHub Actions anti-recursion rule) -- splitting this into "push a tag" /
+# "react to that tag" workflows would silently never fire the second one.
on:
push:
- tags:
- - "v*.*.*"
+ branches: [main]
permissions:
contents: write
+ id-token: write # required for `npm publish --provenance`
jobs:
release:
@@ -23,20 +32,23 @@ jobs:
with:
fetch-depth: 0
- - name: Verify tag matches package.json version
+ - name: Check whether this version is already released
+ id: check
run: |
- TAG_VERSION="${GITHUB_REF_NAME#v}"
- PKG_VERSION=$(node -p "require('./package.json').version")
- if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
- echo "::error::tag $GITHUB_REF_NAME (version $TAG_VERSION) does not match package.json's version $PKG_VERSION"
- exit 1
+ VERSION=$(node -p "require('./package.json').version")
+ TAG="v$VERSION"
+ echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+ echo "tag=$TAG" >> "$GITHUB_OUTPUT"
+ if git rev-parse "$TAG" >/dev/null 2>&1; then
+ echo "already_released=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "already_released=false" >> "$GITHUB_OUTPUT"
fi
- name: Extract this version's CHANGELOG section
- id: notes
+ if: steps.check.outputs.already_released == 'false'
run: |
- TAG_VERSION="${GITHUB_REF_NAME#v}"
- awk -v ver="$TAG_VERSION" '
+ awk -v ver="${{ steps.check.outputs.version }}" '
BEGIN { found=0 }
/^## / {
if (found) exit
@@ -45,11 +57,31 @@ jobs:
found { print }
' CHANGELOG.md > release_notes.md
if [ ! -s release_notes.md ]; then
- echo "No matching CHANGELOG.md section found for $TAG_VERSION; using a generic note." > release_notes.md
+ echo "No matching CHANGELOG.md section found for ${{ steps.check.outputs.version }}; using a generic note." > release_notes.md
fi
- - name: Create GitHub Release
+ - name: Create tag and GitHub Release
+ if: steps.check.outputs.already_released == 'false'
uses: softprops/action-gh-release@v2
with:
+ tag_name: ${{ steps.check.outputs.tag }}
+ target_commitish: ${{ github.sha }}
body_path: release_notes.md
generate_release_notes: true
+
+ - uses: actions/setup-node@v4
+ if: steps.check.outputs.already_released == 'false'
+ with:
+ node-version: "20"
+ registry-url: "https://registry.npmjs.org"
+
+ # Requires an npm access token in this repo's Settings -> Secrets and variables ->
+ # Actions, named NPM_TOKEN (npmjs.com -> your avatar -> Access Tokens -> Generate New
+ # Token -> Granular Access Token or Automation, with publish permission on this
+ # package). Without it, this step fails but the tag/GitHub Release above still stand --
+ # only the npm publish is skipped, so a missing token never blocks the rest of a release.
+ - name: Publish to npm
+ if: steps.check.outputs.already_released == 'false'
+ run: npm publish --provenance --access public
+ env:
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
diff --git a/README.md b/README.md
index aefa19c..b4b2574 100644
--- a/README.md
+++ b/README.md
@@ -395,7 +395,7 @@ CI (`.github/workflows/ci.yml`) runs on every pull request and on pushes to `mai
`tests/test_contract.py` runs on all three OSes, but a handful of its tests build a fake `ffmpeg` as a `#!/bin/sh` script on a PATH shim to force specific FFmpeg 6/7/8/9 fixture layouts through `doctor`'s parser — that technique isn't portable to Windows, so `test_dry_run_never_runs_ffmpeg_and_writes_nothing` and the whole `DoctorDetectionTests` class (fixture-driven layout parsing) are individually `skipIf`'d there and show as `skipped`, not silently absent, in the Windows job's log. Everything else — contract schema, `reencodes_*`, `doctor.tools`, MCP derivation, and every tool exercised through the contract, including `cut.py`'s provenance fields — runs against the real Windows `ffmpeg` on every PR. See [references/ci-platform-pitfalls.md](references/ci-platform-pitfalls.md) for this and other per-OS behaviour differences already diagnosed, before spending a CI cycle re-diagnosing a platform-only failure.
-**Releasing**: bump `version` in `package.json`, merge to `main`, then tag that commit (`git tag vX.Y.Z && git push origin vX.Y.Z`). `.github/workflows/release.yml` picks up from there: it verifies the tag matches `package.json`'s version, extracts that version's `CHANGELOG.md` section, and publishes the GitHub Release automatically — tagging stays a deliberate, manual act; only the release-notes step is automated. A repo that depends on this one (an editing skill, an agent) should pin an `ffmpeg-skill` version by tag or npm version, not by tracking `main` — `main` can be ahead of the last published npm version.
+**Releasing** is fully automated: bump `version` in `package.json` and add the matching `CHANGELOG.md` section in a PR, same as any other change. Once that PR merges to `main`, `.github/workflows/release.yml` takes it from there — no manual tag, no manual npm publish. It checks whether the new version already has a `vX.Y.Z` tag; if not, it creates that tag, publishes a GitHub Release with notes extracted from `CHANGELOG.md`'s matching section, and publishes the package to npm. A push to `main` that doesn't bump the version is a no-op release-wise. npm publishing needs an `NPM_TOKEN` repo secret (an npm access token with publish rights on this package) — without it the tag and GitHub Release still happen, only the npm step is skipped. A repo that depends on this one (an editing skill, an agent) should pin an `ffmpeg-skill` version by tag or npm version, not by tracking `main` — a merged-but-not-yet-released commit on `main` can be ahead of the last published npm version for the few minutes between merge and this workflow completing.
Contributing a change: see [CONTRIBUTING.md](CONTRIBUTING.md).