知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.
Swift androidlinuxlive-captionsmacosmeeting-notesmenubar-appsimultaneous-interpretationspeech-recognitionsubtitlesswiftswiftuitranslationwindows
build: gate each release build on its platform's tests and leave new releases as drafts until scripts/publish-release.sh
wqugurua9dd1b8727b8
diff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 8f44823..3871887 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -3,7 +3,8 @@ name: release# One tag, one version for every platform (VERSION). The CHANGELOG.md section says which platforms# changed (scripts/release_platforms.sh); only those are built and attached, so an app with no# change finds no new release for itself. Android ships only once its signing key is in the-# secrets (android/scripts/keystore.sh --github).+# secrets (android/scripts/keystore.sh --github). Each platform's tests run before its build, and+# the release is left as a draft: nobody's update check sees it until scripts/publish-release.sh.on:push:tags: ["v*.*.*"]@@ -60,6 +61,8 @@ jobs:- uses: actions/checkout@v4with:ref: ${{ env.TAG }}+ - name: Unit tests+ run: scripts/test.sh- name: Build and packagerun: scripts/package.shenv:@@ -82,6 +85,12 @@ jobs:- uses: actions/setup-dotnet@v4with:dotnet-version: "10.0.x"+ - name: Unit tests+ run: |+ dotnet build windows/tests/Cicada.Tests -o windows/build/tests+ windows/build/tests/Cicada.Tests.exe+ - name: Translations+ run: python windows/scripts/strings.py- name: Build and zipshell: pwshrun: |@@ -140,6 +149,28 @@ jobs:sudo apt-get update -q && sudo apt-get install -y -q ffmpeglinux/scripts/build.shmkdir -p dist && cp linux/build/cicada-linux-*.tar.gz "dist/Cicada-${TAG#v}-Linux.tar.gz"+ # What a user gets, as the linux workflow checks it on every push: the tarball installed by its+ # install.sh, unit tests against the shipped voiceprint library, then the GTK app under Xvfb.+ - name: Desktop libraries+ run: sudo apt-get install -y -q python3-gi gir1.2-gtk-3.0 gir1.2-ayatanaappindicator3-0.1 libpulse0 pulseaudio pulseaudio-utils xvfb+ - name: Install+ run: |+ mkdir -p "$RUNNER_TEMP/install" && tar -xzf dist/*.tar.gz -C "$RUNNER_TEMP/install"+ sh "$RUNNER_TEMP/install/cicada-linux/install.sh"+ test -x ~/.local/lib/cicada/bin/cicada+ - name: Unit tests against the shipped voiceprint library+ working-directory: linux+ run: |+ lib="$HOME/.local/lib/cicada/lib/libcicada-voice-$(uname -m).so"+ test -f "$lib"+ CICADA_VOICE_LIB="$lib" scripts/test.sh+ - name: Smoke test of the installed app+ run: |+ cp linux/scripts/smoke.sh linux/scripts/cicadactl ~/.local/lib/cicada/bin/+ pulseaudio --start --exit-idle-time=-1+ pactl load-module module-null-sink sink_name=speakers+ pactl set-default-sink speakers+ SMOKE_VOICES=1 xvfb-run -a ~/.local/lib/cicada/bin/smoke.sh- uses: actions/upload-artifact@v4with:name: linux@@ -164,6 +195,11 @@ jobs:- uses: gradle/actions/setup-gradle@v4with:gradle-version: "9.8.2"+ - name: Unit tests+ run: |+ gradle --console=plain -q :cli:installDist+ JAVA_OPTS="-Dcicada.resources=$PWD/../Resources -Dcicada.androidStrings=$PWD/app/src/main/strings" cli/build/install/cicada-cli/bin/cicada-cli test+ python3 scripts/strings.py- name: Build and signenv:ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}@@ -194,21 +230,22 @@ jobs:path: distmerge-multiple: true- name: Publish the release- # A tag pushed again (history rewritten, tag moved) must not fail on the existing release:- # replace its files and notes instead. Without the Mac app the release is not marked- # latest: Macs on 1.0.0 read releases/latest and would offer a release with nothing for them.+ # A new release is a draft: download it, try it, then scripts/publish-release.sh makes it public+ # (and latest only when it has the Mac app: Macs on 1.0.0 read releases/latest). A tag pushed+ # again (history rewritten, tag moved) must not fail on the existing release: replace its files+ # and notes instead, leaving it a draft or public as it was.run: |rm -f dist/libcicada-voice-*.so # the voiceprint libraries are inside the Linux tarball, not files of their own(cd dist && sha256sum -- * > checksums.txt)cat dist/checksums.txtscripts/release_notes.sh "${TAG#v}" > notes.md[[ "${{ needs.plan.outputs.android }}" == true ]] && sed "s/<version>/${TAG#v}/" .github/release-notes-android.md >> notes.md- latest=true; [[ "${{ needs.plan.outputs.mac }}" == true ]] || latest=falseif gh release view "$TAG" >/dev/null 2>&1; thengh release upload "$TAG" dist/* --clobber- gh release edit "$TAG" --notes-file notes.md --latest=$latest+ gh release edit "$TAG" --notes-file notes.mdelse- gh release create "$TAG" dist/* --title "知了 Cicada ${TAG#v}" --notes-file notes.md --latest=$latest+ gh release create "$TAG" dist/* --draft --title "知了 Cicada ${TAG#v}" --notes-file notes.md+ echo "::notice::Draft $TAG is ready: try its files, then scripts/publish-release.sh ${TAG#v}"fienv:GH_TOKEN: ${{ github.token }}diff --git a/AGENTS.md b/AGENTS.mdindex 75382c8..3c770e2 100644--- a/AGENTS.md+++ b/AGENTS.md@@ -40,7 +40,7 @@ scripts/test.sh # AGENTS.md check + unit testsscripts/build.sh && open build/Cicada.app # dev build: own bundle id, settings, logRELEASE=1 scripts/build.sh # release buildscripts/package.sh # DMG + zip + checksums-scripts/release.sh <x.y.z> # VERSION + CHANGELOG section, tag; CI builds the platforms that changed+scripts/release.sh <x.y.z> # VERSION, CHANGELOG, tag; CI drafts what changed; publish-release.shscripts/deploy-site.sh # build and deploy the site (cicada.indaloop.app)```diff --git a/scripts/publish-release.sh b/scripts/publish-release.shnew file mode 100755index 0000000..8816431--- /dev/null+++ b/scripts/publish-release.sh@@ -0,0 +1,17 @@+#!/usr/bin/env bash+# Makes a draft release public once its files have been tried: scripts/publish-release.sh 1.0.1+# The release workflow leaves every new release a draft, so no update check offers it before this.+# It is marked latest only when it has the Mac app: Macs on 1.0.0 read releases/latest and would+# otherwise offer a release with nothing for them.+set -euo pipefail+VERSION=${1:?usage: scripts/publish-release.sh <version, e.g. 1.0.1>}+TAG="v$VERSION"+REPO=wquguru/cicada+[[ "$(gh release view "$TAG" -R "$REPO" --json isDraft -q .isDraft)" == true ]] || { echo "$TAG is not a draft" >&2; exit 1; }+assets=$(gh release view "$TAG" -R "$REPO" --json assets -q '.assets[].name')+echo "$assets"+latest=false; grep -q '\.dmg$' <<< "$assets" && latest=true+read -r -p "Publish $TAG (latest: $latest)? [y/N] " ok+[[ "$ok" == y ]] || exit 1+gh release edit "$TAG" -R "$REPO" --draft=false --latest=$latest+echo "Published https://github.com/$REPO/releases/tag/$TAG"diff --git a/scripts/release.sh b/scripts/release.shindex 0791322..a9cb7ff 100755--- a/scripts/release.sh+++ b/scripts/release.sh@@ -2,7 +2,7 @@# Cuts a release: scripts/release.sh 1.0.1# Writes the CHANGELOG.md section from the commits since the last tag, sets VERSION (one version# for every platform: Mac, Windows, Android, Linux all build from it), commits, tags v<version> and-# pushes; the release workflow builds and publishes the DMG with that section as its notes.+# pushes; the release workflow builds a draft release with that section as its notes.set -euo pipefailcd "$(dirname "$0")/.."@@ -25,4 +25,4 @@ if [[ "$CURRENT" != "$VERSION" ]]; thenfigit tag -a "v$VERSION" -m "Cicada $VERSION"git push origin main "v$VERSION"-echo "Pushed v$VERSION; follow it at https://github.com/wquguru/cicada/actions/workflows/release.yml"+echo "Pushed v$VERSION; follow it at https://github.com/wquguru/cicada/actions/workflows/release.yml, then try the draft and scripts/publish-release.sh $VERSION"