Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

feat(ci): release candidate pipeline (prerelease + promote workflows)

EtienneLescotda4e1caba7ff
diff --git a/.github/scripts/discord-release-announce.mjs b/.github/scripts/discord-release-announce.mjs
new file mode 100644
index 000000000..331a301e6
--- /dev/null
+++ b/.github/scripts/discord-release-announce.mjs
@@ -0,0 +1,118 @@
+import { info, warning } from "@actions/core";
+import { context, getOctokit } from "@actions/github";
+
+const botToken = (process.env.DISCORD_BOT_TOKEN || "").trim();
+const kind = (process.env.KIND || "stable").trim();
+const stableTag = (process.env.STABLE_TAG || "").trim();
+const rcTag = (process.env.RC_TAG || "").trim();
+const extra = (process.env.EXTRA || "").trim();
+
+const channelId =
+ kind === "rc"
+ ? (process.env.DISCORD_RC_TESTING_CHANNEL_ID || "").trim()
+ : (process.env.DISCORD_RELEASE_CHANNEL_ID || "").trim();
+
+if (!botToken || !channelId) {
+ info(
+ `Discord ${kind} announcement skipped: missing DISCORD_BOT_TOKEN or channel id. ` +
+ `Set DISCORD_${kind === "rc" ? "RC_TESTING_" : ""}CHANNEL_ID as a repo variable.`,
+ );
+ process.exit(0);
+}
+if (!stableTag) {
+ warning("STABLE_TAG missing; skipping.");
+ process.exit(0);
+}
+
+const owner = context.repo.owner;
+const repo = context.repo.repo;
+const releaseUrl = `${context.serverUrl}/${owner}/${repo}/releases/tag/${stableTag}`;
+
+const octokit = getOctokit(process.env.GITHUB_TOKEN);
+
+let releaseBody = "";
+try {
+ const r = await octokit.rest.repos.getReleaseByTag({
+ owner,
+ repo,
+ tag: stableTag,
+ });
+ releaseBody = (r.data.body || "").slice(0, 1500);
+} catch (err) {
+ warning(`Failed to fetch release body: ${err?.message ?? err}`);
+}
+
+let closedIssues = [];
+try {
+ const versionTitle = `v${stableTag.replace(/^v/, "").replace(/-.*$/, "")}`;
+ const milestones = await octokit.paginate(octokit.rest.issues.listMilestones, {
+ owner,
+ repo,
+ state: "closed",
+ per_page: 100,
+ });
+ const m = milestones.find((x) => x.title === versionTitle);
+ if (m) {
+ const issues = await octokit.paginate(octokit.rest.issues.listForRepo, {
+ owner,
+ repo,
+ milestone: `${m.number}`,
+ state: "closed",
+ per_page: 100,
+ });
+ closedIssues = issues
+ .filter((i) => !i.pull_request)
+ .slice(0, 20)
+ .map((i) => `• [#${i.number}](${i.html_url}) ${i.title}`);
+ }
+} catch (err) {
+ warning(`Failed to fetch closed issues: ${err?.message ?? err}`);
+}
+
+const isRc = kind === "rc";
+const title = isRc
+ ? `🧪 ${stableTag} release candidate ready for testing`
+ : `🚀 ${stableTag} released`;
+const color = isRc ? 15844367 : 5814783;
+
+const description = [
+ extra ? `> ${extra}\n` : "",
+ `📦 **Download:** [${stableTag}](${releaseUrl})`,
+ isRc && rcTag ? `_Promoted from \`${rcTag}\`_` : "",
+ closedIssues.length > 0 ? `\n**Closed issues in this release:**\n${closedIssues.join("\n")}` : "",
+ releaseBody ? `\n---\n${releaseBody}` : "",
+]
+ .filter(Boolean)
+ .join("\n");
+
+const payload = {
+ embeds: [
+ {
+ title,
+ url: releaseUrl,
+ description,
+ color,
+ timestamp: new Date().toISOString(),
+ },
+ ],
+ allowed_mentions: { parse: [] },
+};
+
+try {
+ const res = await fetch(`https://discord.com/api/v10/channels/${channelId}/messages`, {
+ method: "POST",
+ headers: {
+ Authorization: `Bot ${botToken}`,
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(payload),
+ });
+ if (!res.ok) {
+ const txt = await res.text();
+ warning(`Discord POST failed ${res.status}: ${txt}`);
+ process.exit(0);
+ }
+ info(`📣 ${kind} announcement posted for ${stableTag} in channel ${channelId}.`);
+} catch (err) {
+ warning(`Discord throw: ${err?.message ?? err}`);
+}
diff --git a/.github/scripts/discord-roadmap-sync.mjs b/.github/scripts/discord-roadmap-sync.mjs
index 96386c2ad..4bb608c3e 100644
--- a/.github/scripts/discord-roadmap-sync.mjs
+++ b/.github/scripts/discord-roadmap-sync.mjs
@@ -186,7 +186,7 @@ async function main() {
`👉 Set DISCORD_ROADMAP_MESSAGE_ID=${messageId} as a repo variable to update this message on future changes.`,
);
info(
- ` gh variable set DISCORD_ROADMAP_MESSAGE_ID ${messageId} --repo ${context.repo.owner}/${context.repo.repo}`,
+ ` gh variable set DISCORD_ROADMAP_MESSAGE_ID --body "${messageId}" --repo ${context.repo.owner}/${context.repo.repo}`,
);
}
} catch (err) {
diff --git a/.github/scripts/release-milestone-close.mjs b/.github/scripts/release-milestone-close.mjs
new file mode 100644
index 000000000..829cbee34
--- /dev/null
+++ b/.github/scripts/release-milestone-close.mjs
@@ -0,0 +1,42 @@
+import { info, warning } from "@actions/core";
+import { getOctokit } from "@actions/github";
+
+const token = (process.env.TOKEN || "").trim();
+const stable = (process.env.STABLE_VERSION || "").trim();
+
+if (!token || !stable) {
+ warning("TOKEN or STABLE_VERSION missing; skipping milestone close.");
+ process.exit(0);
+}
+
+const title = `v${stable}`;
+const owner = process.env.GITHUB_REPOSITORY_OWNER || "";
+const repoFull = process.env.GITHUB_REPOSITORY || "";
+const repo = repoFull.includes("/") ? repoFull.split("/")[1] : repoFull;
+
+if (!owner || !repo) {
+ warning("GITHUB_REPOSITORY not set; skipping.");
+ process.exit(0);
+}
+
+const octokit = getOctokit(token);
+
+const open = await octokit.paginate(octokit.rest.issues.listMilestones, {
+ owner,
+ repo,
+ state: "open",
+ per_page: 100,
+});
+const m = open.find((x) => x.title === title);
+if (!m) {
+ info(`Open milestone "${title}" not found; nothing to close.`);
+ process.exit(0);
+}
+
+await octokit.rest.issues.updateMilestone({
+ owner,
+ repo,
+ milestone_number: m.number,
+ state: "closed",
+});
+info(`Closed milestone "${title}" (#${m.number}).`);
diff --git a/.github/scripts/release-milestone-migrate.mjs b/.github/scripts/release-milestone-migrate.mjs
new file mode 100644
index 000000000..19f296faf
--- /dev/null
+++ b/.github/scripts/release-milestone-migrate.mjs
@@ -0,0 +1,119 @@
+import { info, warning } from "@actions/core";
+import { getOctokit } from "@actions/github";
+
+const ROLLING_NAME = "Next Release";
+const MARKER_PREFIX = "<!-- openscreen-rc-migrated:";
+
+const token = (process.env.TOKEN || "").trim();
+const nextVersion = (process.env.NEXT || "").trim();
+
+if (!token || !nextVersion) {
+ warning("TOKEN or NEXT missing; skipping milestone migration.");
+ process.exit(0);
+}
+
+const versionedName = `v${nextVersion}`;
+const owner = process.env.GITHUB_REPOSITORY_OWNER || "";
+const repoFull = process.env.GITHUB_REPOSITORY || "";
+const repo = repoFull.includes("/") ? repoFull.split("/")[1] : repoFull;
+
+if (!owner || !repo) {
+ warning("GITHUB_REPOSITORY not set; skipping.");
+ process.exit(0);
+}
+
+const octokit = getOctokit(token);
+
+async function findMilestone(title) {
+ const all = await octokit.paginate(octokit.rest.issues.listMilestones, {
+ owner,
+ repo,
+ state: "all",
+ per_page: 100,
+ });
+ return all.find((m) => m.title === title) || null;
+}
+
+async function ensureMilestone(title) {
+ const existing = await findMilestone(title);
+ if (existing && existing.state === "open") return existing;
+ if (existing) {
+ const reopened = await octokit.rest.issues.updateMilestone({
+ owner,
+ repo,
+ milestone_number: existing.number,
+ state: "open",
+ });
+ info(`Reopened milestone "${title}".`);
+ return reopened.data;
+ }
+ const created = await octokit.rest.issues.createMilestone({
+ owner,
+ repo,
+ title,
+ description: `Issues and PRs included in ${title}.`,
+ });
+ info(`Created milestone "${title}".`);
+ return created.data;
+}
+
+async function listMilestoneItems(milestoneNumber) {
+ return octokit.paginate(octokit.rest.issues.listForRepo, {
+ owner,
+ repo,
+ milestone: `${milestoneNumber}`,
+ state: "all",
+ per_page: 100,
+ });
+}
+
+async function hasMarker(issueNumber, versionedTitle) {
+ const marker = `${MARKER_PREFIX}${versionedTitle} -->`;
+ const comments = await octokit.paginate(octokit.rest.issues.listComments, {
+ owner,
+ repo,
+ issue_number: issueNumber,
+ per_page: 100,
+ });
+ return comments.some((c) => c.body && c.body.includes(marker));
+}
+
+async function main() {
+ const rolling = await findMilestone(ROLLING_NAME);
+ if (!rolling) {
+ info(`Rolling milestone "${ROLLING_NAME}" not found; nothing to migrate.`);
+ return;
+ }
+
+ const versioned = await ensureMilestone(versionedName);
+ info(`Target milestone: ${versionedName} (#${versioned.number}).`);
+
+ const items = await listMilestoneItems(rolling.number);
+ info(`Found ${items.length} item(s) in "${ROLLING_NAME}".`);
+
+ let moved = 0;
+ let skipped = 0;
+ for (const item of items) {
+ if (await hasMarker(item.number, versionedName)) {
+ skipped++;
+ continue;
+ }
+ await octokit.rest.issues.update({
+ owner,
+ repo,
+ issue_number: item.number,
+ milestone: versioned.number,
+ });
+ const tag = `${MARKER_PREFIX}${versionedName} -->`;
+ await octokit.rest.issues.createComment({
+ owner,
+ repo,
+ issue_number: item.number,
+ body: `${tag}\nMoved into \`${versionedName}\` as part of the pre-release cut.`,
+ });
+ moved++;
+ }
+ info(`Migrated ${moved}, skipped ${skipped} (already tagged).`);
+}
+
+await main();
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1413552b9..2b8a35b87 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -190,7 +190,7 @@ jobs:
echo "dmg_path=$DMG_OUTPUT" >> "$GITHUB_OUTPUT"
- name: Sign DMG
- if: steps.signing.outputs.enabled == 'true'
+ if: steps.signing.outputs.enabled == 'true' && !contains(github.ref_name, '-')
run: |
codesign --force \
--sign "${{ secrets.MAC_CSC_NAME }}" \
@@ -198,7 +198,7 @@ jobs:
"${{ steps.dmg.outputs.dmg_path }}"
- name: Notarize DMG
- if: steps.signing.outputs.enabled == 'true'
+ if: steps.signing.outputs.enabled == 'true' && !contains(github.ref_name, '-')
run: |
xcrun notarytool submit "${{ steps.dmg.outputs.dmg_path }}" \
--apple-id "${{ secrets.APPLE_ID }}" \
@@ -208,11 +208,11 @@ jobs:
timeout-minutes: 15
- name: Staple notarization ticket
- if: steps.signing.outputs.enabled == 'true'
+ if: steps.signing.outputs.enabled == 'true' && !contains(github.ref_name, '-')
run: xcrun stapler staple "${{ steps.dmg.outputs.dmg_path }}"
- name: Validate stapled DMG
- if: steps.signing.outputs.enabled == 'true'
+ if: steps.signing.outputs.enabled == 'true' && !contains(github.ref_name, '-')
run: |
xcrun stapler validate "${{ steps.dmg.outputs.dmg_path }}"
spctl -a -vv -t install "${{ steps.dmg.outputs.dmg_path }}"
@@ -286,20 +286,33 @@ jobs:
TAG="${INPUT_TAG}"
fi
- if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
- echo "::error::Release tag must look like v1.5.0; got '${TAG}'"
+ if [[ ! "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-(rc|beta|alpha)\.[0-9]+)?$ ]]; then
+ echo "::error::Release tag must look like v1.5.0 or v1.5.0-rc.1; got '${TAG}'"
exit 1
fi
VERSION="${TAG#v}"
+ # Strip pre-release suffix (e.g. "1.5.0-rc.1" -> "1.5.0") for package.json comparison.
+ STABLE_VERSION="${VERSION%%-*}"
PACKAGE_VERSION="$(node -p 'require("./package.json").version')"
- if [[ "$PACKAGE_VERSION" != "$VERSION" ]]; then
- echo "::error::package.json version ${PACKAGE_VERSION} does not match release tag ${TAG}"
+ if [[ "$PACKAGE_VERSION" != "$STABLE_VERSION" ]]; then
+ echo "::error::package.json version ${PACKAGE_VERSION} does not match stable version ${STABLE_VERSION} from tag ${TAG}"
exit 1
fi
+ if [[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+-(rc|beta|alpha)\.[0-9]+$ ]]; then
+ PRERELEASE_FLAG="--prerelease"
+ IS_PRERELEASE="true"
+ else
+ PRERELEASE_FLAG=""
+ IS_PRERELEASE="false"
+ fi
+
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
+ echo "stable_version=$STABLE_VERSION" >> "$GITHUB_OUTPUT"
+ echo "is_prerelease=$IS_PRERELEASE" >> "$GITHUB_OUTPUT"
+ echo "prerelease_flag=$PRERELEASE_FLAG" >> "$GITHUB_OUTPUT"
- name: Download Windows installer
uses: actions/download-artifact@v4
@@ -329,8 +342,9 @@ jobs:
- name: Publish release assets
env:
- GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GH_TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
TAG: ${{ steps.release.outputs.tag }}
+ PRERELEASE_FLAG: ${{ steps.release.outputs.prerelease_flag }}
run: |
mapfile -t FILES < <(find artifacts -type f | sort)
if [[ "${#FILES[@]}" -eq 0 ]]; then
@@ -341,13 +355,22 @@ jobs:
if gh release view "$TAG" >/dev/null 2>&1; then
gh release upload "$TAG" "${FILES[@]}" --clobber
else
+ # shellcheck disable=SC2086
gh release create "$TAG" "${FILES[@]}" \
--target "$GITHUB_SHA" \
--title "$TAG" \
- --generate-notes
+ --generate-notes \
+ $PRERELEASE_FLAG
fi
- gh release edit "$TAG" \
- --draft=false \
- --latest \
- --title "$TAG"
+ if [[ -n "$PRERELEASE_FLAG" ]]; then
+ gh release edit "$TAG" \
+ --draft=false \
+ --latest=false \
+ --title "$TAG"
+ else
+ gh release edit "$TAG" \
+ --draft=false \
+ --latest \
+ --title "$TAG"
+ fi
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 605802bea..3c65e41b6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -40,3 +40,26 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- run: npx vite build
+
+ semantic-pr:
+ name: Validate PR title (semantic)
+ runs-on: ubuntu-latest
+ if: github.event_name == 'pull_request'
+ steps:
+ - uses: amannn/action-semantic-pull-request@v5
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ types: |
+ feat
+ fix
+ chore
+ refactor
+ perf
+ docs
+ test
+ build
+ ci
+ style
+ revert
+ requireScope: false
diff --git a/.github/workflows/prerelease.yml b/.github/workflows/prerelease.yml
new file mode 100644
index 000000000..5c91f28ed
--- /dev/null
+++ b/.github/workflows/prerelease.yml
@@ -0,0 +1,122 @@
+name: Cut a release candidate
+
+on:
+ workflow_dispatch:
+ inputs:
+ bump:
+ description: "Semver bump type from current package.json version"
+ required: true
+ type: choice
+ options: [patch, minor, major]
+ default: minor
+ rc_number:
+ description: "Pre-release counter (rc.1, rc.2, ...)"
+ required: true
+ type: number
+ default: 1
+ target_version:
+ description: "Override the auto-bumped next version (e.g. 2.0.0). Leave empty to bump from package.json."
+ required: false
+ type: string
+
+permissions:
+ contents: write
+ issues: write
+
+concurrency:
+ group: prerelease-${{ github.ref }}
+ cancel-in-progress: false
+
+jobs:
+ prerelease:
+ name: Cut pre-release
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Setup Node.js
+ uses: ./.github/actions/setup
+
+ - name: Calculate next version and RC tag
+ id: version
+ env:
+ BUMP: ${{ inputs.bump }}
+ RC_NUMBER: ${{ inputs.rc_number }}
+ TARGET_VERSION: ${{ inputs.target_version }}
+ run: |
+ set -euo pipefail
+ CURRENT=$(node -p "require('./package.json').version")
+ if [[ -n "$TARGET_VERSION" ]]; then
+ NEXT="$TARGET_VERSION"
+ else
+ IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT"
+ case "$BUMP" in
+ patch) PATCH=$((PATCH + 1)) ;;
+ minor) MINOR=$((MINOR + 1)); PATCH=0 ;;
+ major) MAJOR=$((MAJOR + 1)); MINOR=0; PATCH=0 ;;
+ esac
+ NEXT="${MAJOR}.${MINOR}.${PATCH}"
+ fi
+ PRERELEASE_VERSION="${NEXT}-rc.${RC_NUMBER}"
+ RC_TAG="v${PRERELEASE_VERSION}"
+ echo "current=$CURRENT" >> "$GITHUB_OUTPUT"
+ echo "next=$NEXT" >> "$GITHUB_OUTPUT"
+ echo "prerelease=$PRERELEASE_VERSION" >> "$GITHUB_OUTPUT"
+ echo "rc_tag=$RC_TAG" >> "$GITHUB_OUTPUT"
+ echo "Will cut ${RC_TAG} from ${CURRENT}"
+
+ - name: Migrate issues from "Next Release" to versioned milestone
+ env:
+ TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
+ NEXT: ${{ steps.version.outputs.next }}
+ run: node .github/scripts/release-milestone-migrate.mjs
+
+ - name: Bump package.json to pre-release version
+ env:
+ PRERELEASE: ${{ steps.version.outputs.prerelease }}
+ run: |
+ set -euo pipefail
+ sed -i -E "s|(\"version\"[[:space:]]*:[[:space:]]*\")[^\"]*(\")|\1${PRERELEASE}\2|" package.json
+ echo "package.json version:"
+ grep '"version"' package.json
+
+ - name: Commit package.json bump
+ env:
+ TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
+ run: |
+ set -euo pipefail
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git add package.json
+ git commit -m "chore(release): bump to ${{ steps.version.outputs.prerelease }} [skip ci]"
+ git push
+
+ - name: Push RC tag
+ env:
+ TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
+ RC_TAG: ${{ steps.version.outputs.rc_tag }}
+ run: git push origin "$RC_TAG"
+
+ - name: Announce RC on Discord (#rc-testing)
+ if: success()
+ env:
+ DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
+ DISCORD_RC_TESTING_CHANNEL_ID: ${{ vars.DISCORD_RC_TESTING_CHANNEL_ID }}
+ GITHUB_TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
+ STABLE_TAG: ${{ steps.version.outputs.rc_tag }}
+ KIND: rc
+ run: node .github/scripts/discord-release-announce.mjs
+
+ - name: Workflow summary
+ run: |
+ {
+ echo "## Pre-release cut"
+ echo ""
+ echo "- RC tag: \`${{ steps.version.outputs.rc_tag }}\`"
+ echo "- Stable target: \`v${{ steps.version.outputs.next }}\`"
+ echo "- Build workflow triggered by the tag push will publish the GitHub pre-release."
+ echo "- Announce in #rc-testing on Discord, then run \`Promote RC to stable\` when QA is green."
+ } >> "$GITHUB_STEP_SUMMARY"
diff --git a/.github/workflows/promote.yml b/.github/workflows/promote.yml
new file mode 100644
index 000000000..8e2d90028
--- /dev/null
+++ b/.github/workflows/promote.yml
@@ -0,0 +1,107 @@
+name: Promote RC to stable release
+
+on:
+ workflow_dispatch:
+ inputs:
+ rc_tag:
+ description: "RC tag to promote (e.g. v1.5.0-rc.2)"
+ required: true
+ type: string
+ release_notes_extra:
+ description: "Optional message to prepend to auto-generated release notes"
+ required: false
+ type: string
+ default: ""
+
+permissions:
+ contents: write
+ issues: write
+
+concurrency:
+ group: promote-${{ github.ref }}
+ cancel-in-progress: false
+
+jobs:
+ promote:
+ name: Promote RC to stable
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+
+ - name: Setup Node.js
+ uses: ./.github/actions/setup
+
+ - name: Validate RC tag and compute stable version
+ id: version
+ env:
+ RC_TAG: ${{ inputs.rc_tag }}
+ run: |
+ set -euo pipefail
+ TAG="${RC_TAG}"
+ if [[ ! "$TAG" =~ ^v([0-9]+\.[0-9]+\.[0-9]+)-(rc|beta|alpha)\.[0-9]+$ ]]; then
+ echo "::error::Tag must look like v1.5.0-rc.1; got '${TAG}'"
+ exit 1
+ fi
+ STABLE_VERSION="${BASH_REMATCH[1]}"
+ STABLE_TAG="v${STABLE_VERSION}"
+ echo "rc_tag=$TAG" >> "$GITHUB_OUTPUT"
+ echo "stable_version=$STABLE_VERSION" >> "$GITHUB_OUTPUT"
+ echo "stable_tag=$STABLE_TAG" >> "$GITHUB_OUTPUT"
+ echo "Promoting ${TAG} -> ${STABLE_TAG}"
+
+ - name: Close versioned milestone
+ env:
+ TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
+ STABLE_VERSION: ${{ steps.version.outputs.stable_version }}
+ run: node .github/scripts/release-milestone-close.mjs
+
+ - name: Bump package.json to stable version
+ env:
+ STABLE_VERSION: ${{ steps.version.outputs.stable_version }}
+ run: |
+ set -euo pipefail
+ sed -i -E "s|(\"version\"[[:space:]]*:[[:space:]]*\")[^\"]*(\")|\1${STABLE_VERSION}\2|" package.json
+ echo "package.json version:"
+ grep '"version"' package.json
+
+ - name: Commit package.json bump
+ env:
+ TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
+ run: |
+ set -euo pipefail
+ git config user.name "github-actions[bot]"
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
+ git add package.json
+ git commit -m "chore(release): bump to ${{ steps.version.outputs.stable_version }} [skip ci]"
+ git push
+
+ - name: Push stable tag
+ env:
+ TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
+ STABLE_TAG: ${{ steps.version.outputs.stable_tag }}
+ run: git push origin "$STABLE_TAG"
+
+ - name: Announce stable on Discord
+ if: success()
+ env:
+ DISCORD_BOT_TOKEN: ${{ secrets.DISCORD_BOT_TOKEN }}
+ DISCORD_RELEASE_CHANNEL_ID: ${{ vars.DISCORD_RELEASE_CHANNEL_ID }}
+ GITHUB_TOKEN: ${{ secrets.OPENSCREEN_RELEASE_TOKEN }}
+ STABLE_TAG: ${{ steps.version.outputs.stable_tag }}
+ RC_TAG: ${{ steps.version.outputs.rc_tag }}
+ EXTRA: ${{ inputs.release_notes_extra }}
+ KIND: stable
+ run: node .github/scripts/discord-release-announce.mjs
+
+ - name: Workflow summary
+ run: |
+ {
+ echo "## Release promoted"
+ echo ""
+ echo "- Stable tag: \`${{ steps.version.outputs.stable_tag }}\`"
+ echo "- Promoted from: \`${{ steps.version.outputs.rc_tag }}\`"
+ echo "- Tier 3 (homebrew/winget/nix/aur) will fire on the published release via OPENSCREEN_RELEASE_TOKEN."
+ } >> "$GITHUB_STEP_SUMMARY"
diff --git a/.harness/docs/git-workflow.md b/.harness/docs/git-workflow.md
index 5ddcb911b..a43546d99 100644
--- a/.harness/docs/git-workflow.md
+++ b/.harness/docs/git-workflow.md
@@ -37,4 +37,81 @@ All five must be green before merge. Native helper code is NOT covered by CI —
3. Run locally: `npm run lint && npx tsc --noEmit && npm run test`. For browser/e2e-touching changes, also run the relevant suite.
4. Push and open the PR via `gh pr create`. Use `.github/pull_request_template.md`.
5. Wait for the Mavis reviewer (`openscreen-reviewer`) PASS or address the requested changes.
-6. Merge once CI is green and review is PASS.
+6. Merge once CI is green and review is PASS. PR titles must follow Conventional Commits (enforced by the `semantic-pr` job in `ci.yml`) — this keeps the auto-generated release notes clean.
+
+## Release flow
+
+Two `workflow_dispatch` workflows cut a release. Both run on `main` directly (trunk-based, no `next` branch). Both require the `OPENSCREEN_RELEASE_TOKEN` secret — see `docs/secrets.md`.
+
+### Step 1: cut a release candidate
+
+`Actions` → `Cut a release candidate` → `Run workflow`.
+
+- `bump`: `patch | minor | major` (default `minor`)
+- `rc_number`: integer, default `1` (use `.2`, `.3`, … for subsequent RCs)
+- `target_version` (optional): override the auto-computed next version (e.g. `2.0.0` when bumping straight to a major)
+
+The workflow:
+
+1. Computes the next SemVer from `package.json` + `bump`, builds `vX.Y.Z-rc.N`.
+2. Migrates every issue/PR in the rolling `Next Release` milestone into a fresh `vX.Y.Z` milestone. Each migrated item gets a hidden marker comment so re-running is idempotent.
+3. Commits `package.json` → `X.Y.Z-rc.N` to `main`.
+4. Pushes the tag `vX.Y.Z-rc.N`. This triggers `build.yml`, which publishes a **GitHub pre-release** (badged as such, does not become "Latest"). macOS notarization is skipped on RC tags.
+5. Posts in `#rc-testing` on Discord with the download link.
+
+Tier 3 (homebrew/winget/nix/aur) does **not** run on pre-releases — they're already gated on `!prerelease`.
+
+### Step 2: announce and QA
+
+Pin the pre-release link in `#rc-testing`. Get the maintainer team + a few early adopters to install and smoke-test.
+
+If the RC has a regression, fix forward on `main` and re-cut as `vX.Y.Z-rc.(N+1)`. The previous RC is auto-superseded by GitHub.
+
+### Step 3: promote to stable
+
+`Actions` → `Promote RC to stable release` → `Run workflow`.
+
+- `rc_tag`: e.g. `v1.5.0-rc.2`
+- `release_notes_extra` (optional): a one-paragraph note that gets prepended to the auto-generated release notes
+
+The workflow:
+
+1. Validates the tag matches `^vX.Y.Z-(rc|beta|alpha)\.N$`.
+2. Closes the `vX.Y.Z` milestone (snapshotting it for the release notes).
+3. Strips `-rc.N` from `package.json`.
+4. Pushes the tag `vX.Y.Z`. This triggers `build.yml` (full notarization) and the `release: published` event — which now fires Tier 3 (homebrew/winget/nix/aur) thanks to `OPENSCREEN_RELEASE_TOKEN`.
+5. Posts in `#announcements` on Discord with the release notes + a "Closed issues in this release" list pulled from the milestone.
+
+### Manual fallback (emergency)
+
+If the dispatch UI is unavailable, the same flow works from a shell:
+
+```bash
+# Cut RC (skips milestone migration and Discord announce)
+git tag v1.5.0-rc.1 <sha-of-main>
+git push origin v1.5.0-rc.1
+
+# Promote (skips milestone close and Discord announce)
+git tag v1.5.0 <sha-of-main>
+git push origin v1.5.0
+```
+
+The pipeline can't tell the difference between a manually-pushed tag and a workflow-pushed one — same `build.yml` runs either way.
+
+### Backports / patch on a previous line
+
+For a `v1.4.2` while `v1.5.0` is in flight:
+
+1. Branch `release/1.4.x` from the `v1.4.0` (or `v1.4.1`) tag.
+2. Cherry-pick the fix commits.
+3. Push the branch, then `git tag v1.4.2-rc.1` on the branch tip.
+4. `git push origin release/1.4.x v1.4.2-rc.1` — `build.yml` works from any branch.
+
+No new workflow code is needed; the tag-pushed trigger is branch-agnostic.
+
+### Issue tracking during a release cycle
+
+- **Daily state**: issues/PRs accumulate in the rolling `Next Release` milestone. `merged-pr-bookkeeping.yml` adds them automatically on PR merge; maintainers can also drag issues in by hand.
+- **At RC cut**: `prerelease.yml` snapshots `Next Release` into a versioned `vX.Y.Z` milestone. The rolling milestone is left open and empty for new work.
+- **Between RC cut and promote**: any PR that merges during the RC window lands back in the empty `Next Release`. It is **not** retroactively added to `vX.Y.Z`. If a critical fix lands, cut `vX.Y.Z-rc.(N+1)` instead of promoting.
+- **At promote**: `promote.yml` closes the `vX.Y.Z` milestone and uses its closed issues to populate the Discord release announcement.
diff --git a/AGENTS.md b/AGENTS.md
index d92b0136f..aea4974cc 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -47,9 +47,20 @@ OpenScreen is a free, open-source screen recorder and video editor (Electron + R
- Branch from `main`; never push to it directly.
- Commit messages: short imperative summary, optional body. Recent style mixes conventional-ish prefixes (`ci:`, `chore:`, `fix:`) with plain messages — either is fine, just be consistent within a PR.
+- **PR titles must follow Conventional Commits** (`feat:`, `fix:`, `chore:`, `refactor:`, `perf:`, `docs:`, `test:`, `build:`, `ci:`, `style:`, `revert:`). Enforced by the `semantic-pr` job in `ci.yml`. This feeds GitHub's auto-generated release notes with clean categories.
- Open PR via `gh pr create` once CI is green.
- PR template is in `.github/pull_request_template.md`.
+## Release flow
+
+Two `workflow_dispatch` workflows cut a release with a pre-release candidate (RC) first, then promote to stable. Trunk-based, no extra branch. Full operational guide in `.harness/docs/git-workflow.md` § Release flow.
+
+- **Cut RC**: Actions → "Cut a release candidate" → Run workflow. Inputs: `bump` (patch|minor|major), `rc_number` (default 1), optional `target_version` override. Snaps issues out of the rolling `Next Release` milestone into a versioned `vX.Y.Z` milestone, bumps `package.json`, pushes the `vX.Y.Z-rc.N` tag, which triggers the existing `build.yml` to publish a GitHub pre-release. Notarization is skipped on RCs. Notifies `#rc-testing` on Discord.
+- **Promote RC**: Actions → "Promote RC to stable release" → Run workflow. Input: `rc_tag` (e.g. `v1.5.0-rc.2`), optional `release_notes_extra`. Closes the `vX.Y.Z` milestone, strips `-rc.N` from `package.json`, pushes `vX.Y.Z` tag, which triggers `build.yml` to publish a stable release (full notarization, Tier 3 homebrew/winget/nix/aur fires). Notifies `#announcements` on Discord.
+- **Manual fallback**: `git tag vX.Y.Z-rc.N <sha> && git push origin vX.Y.Z-rc.N` does the same as Cut RC (minus the milestone migration and Discord announce) — useful for emergency cuts.
+
+Both workflows require the `OPENSCREEN_RELEASE_TOKEN` secret (a fine-grained PAT with `contents: write` + `issues: write`). This is the standard fix for `release: published` not triggering downstream workflows when the release is created by `GITHUB_TOKEN`. See `docs/secrets.md`.
+
## Security
- Never commit secrets. `.env.example` exists; real `.env` is gitignored.
diff --git a/docs/github-actions-workflows.md b/docs/github-actions-workflows.md
index 282fa20dd..cfc810f1d 100644
--- a/docs/github-actions-workflows.md
+++ b/docs/github-actions-workflows.md
@@ -2,7 +2,7 @@
## Overview
-The repository uses 12 workflow files across four functional tiers. This document describes the triggers, job dependencies, and artifact flow for each tier.
+The repository uses 14 workflow files across five functional tiers. This document describes the triggers, job dependencies, and artifact flow for each tier.
## Workflow dependency graph
@@ -14,10 +14,12 @@ graph TD
ci_typecheck[typecheck]
ci_test[test]
ci_build[build]
+ ci_semantic[semantic-pr]
ci --> ci_lint
ci --> ci_typecheck
ci --> ci_test
ci --> ci_build
+ ci --> ci_semantic
end
subgraph Tier 2 - Release build
@@ -34,6 +36,13 @@ graph TD
build_linux --> build_release
end
+ subgraph Tier 2.5 - Release management
+ prerelease[prerelease.yml<br/>dispatch]
+ promote[promote.yml<br/>dispatch]
+ prerelease -->|push tag vX.Y.Z-rc.N| build
+ promote -->|push tag vX.Y.Z| build
+ end
+
subgraph Tier 3 - Package registries
homebrew[update-homebrew-cask.yml<br/>release published]
winget[publish-winget.yml<br/>release published]
@@ -53,12 +62,16 @@ graph TD
diag --> diag_mac
end
- build_release -->|gh release create| homebrew
- build_release -->|gh release create| winget
- build_release -->|gh release create| nix
- build_release -->|gh release create| aur
+ build_release -->|PAT: gh release create| homebrew
+ build_release -->|PAT: gh release create| winget
+ build_release -->|PAT: gh release create| nix
+ build_release -->|PAT: gh release create| aur
+ promote -->|if: success| discord_announce_rc[discord-release-announce.mjs<br/>#rc-testing]
+ prerelease -->|if: success| discord_announce_stable[discord-release-announce.mjs<br/>#announcements]
```
+> Note: the announce-edge arrows above are inverted for readability — `prerelease.yml` posts to `#rc-testing`, and `promote.yml` posts to `#announcements`.
+
## Tier 1: CI checks
**File:** `ci.yml`
@@ -92,6 +105,55 @@ Triggered by version tags (`v*`) or manual `workflow_dispatch` (with optional ma
All three build jobs use a shared caption-assets cache keyed by `runner.os` and the hash of `scripts/fetch-caption-model.mjs` to avoid cross-platform cache collisions.
+## Tier 2.5: Release management
+
+Two `workflow_dispatch` workflows manage the release cycle. Both run on `main` and require the `OPENSCREEN_RELEASE_TOKEN` secret.
+
+### prerelease.yml
+
+Triggered manually to cut a release candidate.
+
+**Inputs:** `bump` (`patch|minor|major`, default `minor`), `rc_number` (default `1`), `target_version` (optional override).
+
+**Steps:**
+1. Checkout, setup Node.
+2. Compute next SemVer from `package.json` + `bump`, derive `vX.Y.Z-rc.N` tag.
+3. **Migrate** all items from the rolling `Next Release` milestone into a fresh `vX.Y.Z` milestone (idempotent — each migrated item gets an HTML marker comment).
+4. Bump `package.json` to `X.Y.Z-rc.N` and commit on `main`.
+5. Push the `vX.Y.Z-rc.N` tag → triggers `build.yml`.
+6. Announce in `#rc-testing` on Discord via `discord-release-announce.mjs`.
+
+### promote.yml
+
+Triggered manually to promote an RC to a stable release.
+
+**Inputs:** `rc_tag` (e.g. `v1.5.0-rc.2`), `release_notes_extra` (optional).
+
+**Steps:**
+1. Validate the tag matches `^vX.Y.Z-(rc|beta|alpha)\.N$`; derive `X.Y.Z`.
+2. Close the `vX.Y.Z` milestone (snapshots the closed-issue list for release notes).
+3. Strip `-rc.N` from `package.json` and commit on `main`.
+4. Push the `vX.Y.Z` tag → triggers `build.yml` → publishes a stable release.
+5. Tier 3 fires automatically because the release was created with `OPENSCREEN_RELEASE_TOKEN` (which propagates the `release: published` event).
+6. Announce in `#announcements` on Discord with the release notes + closed-issue list.
+
+### Manual fallback
+
+```bash
+git tag v1.5.0-rc.1 <sha>
+git push origin v1.5.0-rc.1
+
+# later
+git tag v1.5.0 <sha>
+git push origin v1.5.0
+```
+
+This works because `build.yml` is triggered by any tag matching `v*`. It skips milestone migration and Discord announcements — useful for emergency cuts when the dispatch UI is unavailable.
+
+### Why a fine-grained PAT (`OPENSCREEN_RELEASE_TOKEN`)?
+
+`GITHUB_TOKEN` cannot trigger downstream workflows from the actions it performs. Specifically, `gh release create` using `GITHUB_TOKEN` does **not** fire the `release: published` event, so homebrew/winget/nix/aur would silently skip every release. The fine-grained PAT (scoped to `getopenscreen/openscreen` with `contents: write` + `issues: write`) is the standard fix. See `docs/secrets.md` for creation and rotation instructions.
+
## Tier 3: Package registries
These workflows react to `release: published` events and push the release to external package registries. Each also supports `workflow_dispatch` for manual re-runs.
diff --git a/docs/secrets.md b/docs/secrets.md
new file mode 100644
index 000000000..6c7e8e532
--- /dev/null
+++ b/docs/secrets.md
@@ -0,0 +1,103 @@
+# Secrets and tokens
+
+OpenScreen uses a small set of GitHub Actions secrets and repository variables. This file documents what each one does and how to create or rotate it.
+
+## Required for releases
+
+### `OPENSCREEN_RELEASE_TOKEN`
+
+A **fine-grained personal access token** used by the release pipeline (`build.yml#publish-release`, `prerelease.yml`, `promote.yml`) for the actions that `GITHUB_TOKEN` cannot perform reliably:
+
+- Creating a GitHub Release via `gh release create` such that the `release: published` event **does** fire downstream workflows (homebrew/winget/nix/aur). With `GITHUB_TOKEN`, the event is suppressed to prevent recursive workflow runs.
+- Pushing commits and tags to `main` from `prerelease.yml` and `promote.yml` in a way that can later trigger downstream CI.
+- Closing milestones and posting comments during the issue-migration step.
+
+**Why not just use `GITHUB_TOKEN` for everything else?**
+
+Most of the repo's workflows (CI, build, Tier 3 publishers, Discord sync) only need read access or scoped write access within a single repo. `GITHUB_TOKEN` is fine for those and is the safer default. The release pipeline needs cross-workflow event firing, which only a PAT can provide.
+
+**How to create it:**
+
+1. Go to <https://github.com/settings/tokens?type=beta> (fine-grained PATs).
+2. **Resource owner**: `getopenscreen` (only this org — do not grant access to personal repos).
+3. **Repository access**: `getopenscreen/openscreen` only.
+4. **Permissions**:
+ - `Contents`: Read and write
+ - `Issues**: Read and write
+ - **Pull requests**: Read-only (the release pipeline never opens PRs; the existing `bump-nix-package.yml` workflow keeps using `GITHUB_TOKEN` for its PR)
+ - **Metadata**: Read-only (auto-selected)
+5. **Expiration**: 1 year. Set a calendar reminder to rotate.
+6. Generate the token, copy it once, then add it as a repository secret. The `gh` CLI does **not** accept the value as a positional argument — use `--body` or stdin:
+ ```bash
+ # Either:
+ gh secret set OPENSCREEN_RELEASE_TOKEN --body "ghp_xxxxxxxxxxxxxxxxxxxx" --repo getopenscreen/openscreen
+ # Or:
+ echo "ghp_xxxxxxxxxxxxxxxxxxxx" | gh secret set OPENSCREEN_RELEASE_TOKEN --repo getopenscreen/openscreen
+ ```
+7. Verify by triggering a test `workflow_dispatch` on `prerelease.yml` with `bump=patch`, `rc_number=99` against an empty milestone, then revert the resulting `package.json` bump PR/commit.
+
+**Rotation:**
+
+Old token and new token both work in parallel until the old one expires or is revoked. Rotate by:
+
+1. Generate the new token.
+2. Update the secret.
+3. Revoke the old token.
+
+There's no need to coordinate a rotation window — the release pipeline runs at most a few times per month.
+
+## Required for Discord announcements
+
+### `DISCORD_BOT_TOKEN`
+
+Bot token from a Discord application added to the OpenScreen Discord server with the `bot` scope and at minimum:
+
+- `Send Messages` in `#rc-testing` and the release-announcement channel
+- `Manage Messages` if you want the roadmap-sync workflow to pin its message
+- `Read Message History` (usually default)
+
+Stored as a repository secret.
+
+### `DISCORD_RC_TESTING_CHANNEL_ID`
+
+Snowflake ID of the Discord channel where release candidates are announced. Set as a **repository variable** (not a secret — it's not sensitive).
+
+```bash
+gh variable set DISCORD_RC_TESTING_CHANNEL_ID --body "1521416826146263051" --repo getopenscreen/openscreen
+```
+
+### `DISCORD_RELEASE_CHANNEL_ID`
+
+Snowflake ID of the channel where stable releases are announced. Repository variable.
+
+```bash
+gh variable set DISCORD_RELEASE_CHANNEL_ID --body "<id>" --repo getopenscreen/openscreen
+```
+
+### `DISCORD_ROADMAP_CHANNEL_ID` and `DISCORD_ROADMAP_MESSAGE_ID`
+
+Used by `discord-roadmap-sync.yml` to keep the pinned roadmap message in sync. Repository variables.
+
+## Tier 3 package registries
+
+Each external registry has its own credential set. See the per-workflow README comments at the top of these files:
+
+- `.github/workflows/update-homebrew-cask.yml` — `HOMEBREW_TAP_TOKEN`, `HOMEBREW_TAP_OWNER`, `HOMEBREW_TAP_REPO`, `HOMEBREW_CASK_NAME`
+- `.github/workflows/publish-winget.yml` — `WINGET_ACC_TOKEN`, `WINGET_IDENTIFIER`
+- `.github/workflows/bump-nix-package.yml` — uses `GITHUB_TOKEN` (no extra secret required)
+- `.github/workflows/aur-publish.yml` — `AUR_SSH_PRIVATE_KEY`, `AUR_KNOWN_HOSTS`, `AUR_PACKAGE_NAME`
+
+All four already gate on `!prerelease`, so a `vX.Y.Z-rc.N` tag will not push to homebrew/winget/nix/aur.
+
+## Apple notarization
+
+`build.yml` skips notarization when the tag contains a `-` (i.e. any pre-release), so the macOS secrets below are only consulted for stable releases:
+
+- `MAC_CERTIFICATE_P12` (base64 of the Developer ID Application `.p12`)
+- `MAC_CERTIFICATE_PASSWORD`
+- `MAC_CSC_NAME`
+- `APPLE_ID`
+- `APPLE_TEAM_ID`
+- `APPLE_APP_SPECIFIC_PASSWORD`
+
+If any of these is missing, the build produces an **unsigned** DMG without notarization. This is the expected behavior for forks and CI debug runs. The release pipeline still works; the macOS DMG will trigger a Gatekeeper warning on first install.
\ No newline at end of file