diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0ab31ce..24f821c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: Release -# A version tag (v0.1.0) builds the Windows MSI and the macOS .dmg files and publishes them as a -# GitHub release. A pull request that changes the packaging, or a run by hand, builds the same +# A version tag (v0.1.0) builds the Windows MSI, the macOS .dmg files and the Linux .deb and +# .tar.gz and publishes them as a GitHub release. A pull request that changes the packaging, or a run by hand, builds the same # installers as workflow artifacts only, so packaging is proven before anything is tagged. on: push: @@ -148,9 +148,51 @@ jobs: path: dist/*.dmg if-no-files-found: error + linux: + needs: version + runs-on: ubuntu-latest + timeout-minutes: 20 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 + with: + dotnet-version: '10.0.x' + + - name: Publish + env: + VERSION: ${{ needs.version.outputs.version }} + run: > + dotnet publish src/Freizeichen.App/Freizeichen.App.csproj -r linux-x64 ${{ env.PUBLISH_FLAGS }} + "-p:Version=${VERSION}" -o publish + + - name: Build .deb and .tar.gz + env: + VERSION: ${{ needs.version.outputs.version }} + run: packaging/linux/build-linux.sh "$VERSION" publish dist + + # Installing the .deb proves its dependencies resolve on a current Ubuntu. + - name: Check packages + env: + VERSION: ${{ needs.version.outputs.version }} + run: | + sudo apt-get update + sudo apt-get install -y desktop-file-utils ./dist/*.deb + test -x /usr/bin/freizeichen + desktop-file-validate /usr/share/applications/freizeichen.desktop + tar -tzf "dist/freizeichen-${VERSION}-linux-x64.tar.gz" | grep -qx "freizeichen-${VERSION}/Freizeichen" + + - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 + with: + name: linux + path: dist/* + if-no-files-found: error + release: if: github.event_name == 'push' - needs: [version, windows, macos] + needs: [version, windows, macos, linux] runs-on: ubuntu-latest timeout-minutes: 10 permissions: @@ -179,6 +221,7 @@ jobs: **Installation** - **Windows**: \`freizeichen-${VERSION}-windows-x64.msi\` ausführen. Danach Freizeichen starten, den Bluetooth-Port wählen und „Als Standard festlegen“ drücken. - **macOS**: Die passende \`.dmg\` öffnen (\`arm64\` für Apple-Chips, \`x64\` für Intel) und Freizeichen in „Programme“ ziehen. + - **Linux** (x64): Debian/Ubuntu: \`sudo apt install ./freizeichen_*_amd64.deb\`, danach \`freizeichen\` starten. Andere Distributionen: \`freizeichen-${VERSION}-linux-x64.tar.gz\` entpacken und \`Freizeichen\` starten. Das Telefon mit \`sudo rfcomm bind 0 1\` als \`/dev/rfcomm0\` anlegen; der Benutzer braucht die Gruppe \`dialout\`. Beim \`.tar.gz\` „Als Standard festlegen“ drücken. **Die Pakete sind nicht signiert.** Beim ersten Start: - **Windows**: SmartScreen → „Weitere Informationen“ → „Trotzdem ausführen“. diff --git a/README.md b/README.md index 0c78558..a154b3d 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ Die Pakete liegen unter [Releases](../../releases). |---|---|---| | **Windows** (x64) | `freizeichen--windows-x64.msi` ausführen | SmartScreen → „Weitere Informationen“ → „Trotzdem ausführen“ | | **macOS** | `.dmg` öffnen (`arm64` für Apple-Chips, `x64` für Intel), Freizeichen in „Programme“ ziehen | Rechtsklick auf Freizeichen.app → „Öffnen“ | -| **Linux** | kein Paket – aus dem Quellcode bauen, siehe [For developers](#for-developers) | Port mit `rfcomm bind` anlegen; „Als Standard festlegen“ trägt Freizeichen für `tel:`-Links ein | +| **Linux** (x64) | Debian/Ubuntu: `sudo apt install ./freizeichen__amd64.deb`; sonst `freizeichen--linux-x64.tar.gz` entpacken | Port mit `rfcomm bind` anlegen, Benutzer in die Gruppe `dialout`; beim `.tar.gz` „Als Standard festlegen“ | Die Pakete sind noch nicht signiert. Ob ein Download unverändert ist, zeigt `SHA256SUMS.txt` im Release: `sha256sum -c SHA256SUMS.txt` (Linux) bzw. `shasum -a 256 -c SHA256SUMS.txt` (macOS). @@ -155,7 +155,9 @@ make help # everything else On Linux the phone appears as a serial port only after `sudo rfcomm bind 0 1`. *Als Standard festlegen* writes `~/.local/share/applications/freizeichen.desktop`, pointing at the -running executable, and makes it the `x-scheme-handler/tel` default with `xdg-mime`. +running executable, and makes it the `x-scheme-handler/tel` default with `xdg-mime`. The `.deb` +(built by `packaging/linux/build-linux.sh`) also installs a system entry under the same name in +`/usr/share/applications`, so a user entry written later shadows it. ### Layout diff --git a/packaging/linux/build-linux.sh b/packaging/linux/build-linux.sh new file mode 100755 index 0000000..996f99f --- /dev/null +++ b/packaging/linux/build-linux.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env bash +# Package a linux-x64 publish output as a .tar.gz for any distribution and a .deb for +# Debian/Ubuntu. Needs dpkg-deb. Runs on the ubuntu-latest CI runner. +# +# build-linux.sh +set -euo pipefail + +VERSION="$1" +PUBLISH_DIR="$2" +OUT_DIR="$3" + +STAGE="$(mktemp -d)" +trap 'rm -rf "$STAGE"' EXIT +mkdir -p "$OUT_DIR" + +# The tarball: unpack, start Freizeichen, press "Als Standard festlegen". The button writes the +# user's own desktop entry pointing at wherever the binary was unpacked. +TAR_ROOT="freizeichen-${VERSION}" +install -d "$STAGE/tar/$TAR_ROOT" +cp -R "$PUBLISH_DIR"/. "$STAGE/tar/$TAR_ROOT/" +# The runner's umask leaks into the archives otherwise. +chmod -R u=rwX,go=rX "$STAGE/tar" +chmod 755 "$STAGE/tar/$TAR_ROOT/Freizeichen" +TARBALL="$OUT_DIR/freizeichen-${VERSION}-linux-x64.tar.gz" +tar -C "$STAGE/tar" --owner=0 --group=0 --numeric-owner --sort=name -czf "$TARBALL" "$TAR_ROOT" + +# The .deb: the program under /usr/lib, a /usr/bin link, and a system desktop entry so tel: links +# reach Freizeichen without the button. The entry's file name matches +# LinuxTelHandlerRegistration.EntryName: the user entry the button writes then shadows this one +# under the same id. desktop-file-utils' dpkg trigger refreshes the MIME cache. +ROOT="$STAGE/deb" +install -d "$ROOT/DEBIAN" "$ROOT/usr/lib/freizeichen" "$ROOT/usr/bin" \ + "$ROOT/usr/share/applications" "$ROOT/usr/share/doc/freizeichen" +cp -R "$PUBLISH_DIR"/. "$ROOT/usr/lib/freizeichen/" +ln -s ../lib/freizeichen/Freizeichen "$ROOT/usr/bin/freizeichen" + +cat > "$ROOT/usr/share/applications/freizeichen.desktop" <<'DESKTOP' +[Desktop Entry] +Type=Application +Name=Freizeichen +Comment=Wählt tel:-Links über ein Gigaset DL500A per Bluetooth +Exec=/usr/bin/freizeichen %u +Terminal=false +Categories=Network;Telephony; +MimeType=x-scheme-handler/tel; +DESKTOP + +cat > "$ROOT/usr/share/doc/freizeichen/copyright" <<'COPYRIGHT' +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Freizeichen +Source: https://github.com/CodeForFire/freizeichen + +Files: * +Copyright: 2026 Thomas Müller +License: MIT + See /usr/lib/freizeichen/LICENSE.txt. The bundled fonts are under the SIL Open Font + License 1.1 (/usr/lib/freizeichen/OFL.txt); further third-party notices are in + /usr/lib/freizeichen/THIRD-PARTY-NOTICES.md. +COPYRIGHT + +# Debian sorts "~" before everything, so a prerelease 0.2.0-rc.1 becomes 0.2.0~rc.1 and installs +# below the final 0.2.0. A self-contained .NET app still needs the system's ICU, whose package +# name carries its version; the alternatives cover Debian 12/13 and Ubuntu 24.04 onwards. +DEB_VERSION="${VERSION//-/\~}" +INSTALLED_KB=$(du -sk "$ROOT/usr" | cut -f1) +cat > "$ROOT/DEBIAN/control" < +Homepage: https://github.com/CodeForFire/freizeichen +Installed-Size: ${INSTALLED_KB} +Depends: libc6, libstdc++6, libgcc-s1, zlib1g, libfontconfig1, libx11-6, libice6, libsm6, xdg-utils, libicu72 | libicu74 | libicu76 | libicu77 | libicu78 +Recommends: bluez +Description: Dial tel: links on a Gigaset DL500A over Bluetooth + Freizeichen registers as the tel: handler and dials the number on a Gigaset + DL500A through its Bluetooth serial port, after a confirm window. +CONTROL + +chmod -R u=rwX,go=rX "$ROOT" +chmod 755 "$ROOT/usr/lib/freizeichen/Freizeichen" +DEB="$OUT_DIR/freizeichen_${DEB_VERSION}_amd64.deb" +dpkg-deb --root-owner-group -Zxz --build "$ROOT" "$DEB" 1>&2 + +echo "$TARBALL" +echo "$DEB"