name: Release # Pushing a version tag (v0.2.0) builds and publishes the Windows + Linux installers. Building on a # private repo bills Actions minutes with steep multipliers (macOS 10x, Windows 2x), so releases are # deliberate — tag when you mean it — rather than one per merge. macOS carries the 10x multiplier and # is built only on demand via workflow_dispatch, which attaches the .dmg to the release for that # version. on: push: tags: ['v*'] workflow_dispatch: inputs: version: description: Version to build the macOS .dmg for (e.g. 0.2.0), matching an existing v-tag release. required: true # Read-only by default. Only the `release` job, which creates the GitHub # release and uploads the packages, escalates to contents: write; the build # jobs just compile and hand artifacts over. permissions: contents: read env: PUBLISH_FLAGS: >- -c Release --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:DebugType=none -p:DebugSymbols=false jobs: version: runs-on: ubuntu-latest outputs: version: ${{ steps.v.outputs.version }} msi_version: ${{ steps.v.outputs.msi_version }} version_code: ${{ steps.v.outputs.version_code }} prerelease: ${{ steps.v.outputs.prerelease }} steps: # tag push -> strip the leading 'v' from the tag; dispatch -> the supplied input. # # A prerelease tag (v0.6.0-beta.1) needs two spellings of that one version, because the # packaging formats disagree about what a suffix means: # version 0.6.0-beta.1 every file name, the APK, -p:Version=, the CHANGELOG heading # msi_version 0.6.0 WiX rejects a non-numeric ProductVersion outright # # The .deb needs a third, 0.6.0~beta.1, for its control field only — but that one is derived # inside packaging/linux/build-deb.sh, next to the control file it serves, so the file name # and the field cannot drift apart. It is deliberately NOT a file name: GitHub rewrites a '~' # in a release asset name to '.', which once left SHA256SUMS.txt naming a download that did # not exist (#448). # Before `v`, and unconditionally: that step derives the Android versionCode with # scripts/android-version-code.sh, so the checkout has to have happened. It used to sit # after `v` and only on a push, which was fine while the step was self-contained. - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - id: v env: REF_NAME: ${{ github.ref_name }} INPUT_VERSION: ${{ inputs.version }} EVENT_NAME: ${{ github.event_name }} run: | if [ "$EVENT_NAME" = "push" ]; then v="${REF_NAME#v}" else v="${INPUT_VERSION}" fi case "$v" in *-*) prerelease=true ;; *) prerelease=false ;; esac # Android needs a fourth spelling of the version, and an integer one. Google Play # refuses any upload whose versionCode is not strictly greater than every versionCode # already uploaded -- to any track, forever -- so it is derived, never typed. It faces # the same ordering problem the .deb solves with '~': a prerelease must sort BELOW the # final release of the same version. # # The formula lives in scripts/android-version-code.sh rather than here, because # `make aab` needs the same number when it builds the bundle that actually goes to # Play. Two copies that could disagree is the one thing this must not be. code=$(scripts/android-version-code.sh "$v") || { echo "::error::$v has no versionCode under this scheme - see docs/releasing.md" exit 1 } { echo "version=$v" echo "msi_version=${v%%-*}" echo "version_code=$code" echo "prerelease=$prerelease" } >> "$GITHUB_OUTPUT" # The release body links to this section, and a tag without one would publish # notes-less. Checked here, in the only job that runs before the Windows (2x) and # Android builds, so a forgotten release section costs seconds rather than minutes. # # Final releases only. A prerelease (v0.6.0-beta.1) is cut from work in progress, # before that version's section is assembled, so requiring one would block exactly # the beta tagging this workflow supports. The body links to CHANGELOG.md rather # than inlining it, so a beta without a section still reads correctly. - name: Verify the tag has a changelog section if: >- github.event_name == 'push' && steps.v.outputs.prerelease == 'false' env: VERSION: ${{ steps.v.outputs.version }} run: | grep -q "^## \[${VERSION}\]" CHANGELOG.md || { echo "::error::No CHANGELOG.md section for v${VERSION} — assemble the release section before tagging." exit 1 } windows: needs: version if: github.event_name == 'push' runs-on: windows-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: dotnet-version: '10.0.x' - name: Publish run: > dotnet publish src/LageBuch.App/LageBuch.App.csproj -r win-x64 ${{ env.PUBLISH_FLAGS }} -p:Version=${{ needs.version.outputs.version }} -o publish - name: Install WiX run: | dotnet tool install --global wix --version 5.0.2 echo "$env:USERPROFILE\.dotnet\tools" >> $env:GITHUB_PATH - name: Build MSI # Absolute paths: WiX resolves relative to the .wxs file's own directory, # not the working directory, so a bare "publish" would look under packaging/windows. # msi_version, not version: a ProductVersion must be numeric, so the MSI inside a # v0.6.0-beta.1 release identifies itself as 0.6.0. The file name keeps the full version. # -arch x64: WiX defaults to an x86 package, which installs ProgramFiles64Folder into # "Program Files (x86)" and registers under WOW6432Node — wrong for a win-x64 publish. run: > wix build packaging/windows/Lagebuch.wxs -arch x64 -d Version=${{ needs.version.outputs.msi_version }} -d "PublishDir=${{ github.workspace }}\publish" -d "IconFile=${{ github.workspace }}\src\LageBuch.App\Assets\icon.ico" -o "lagebuch-${{ needs.version.outputs.version }}-x64.msi" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: msi path: '*.msi' if-no-files-found: error linux: needs: version if: github.event_name == 'push' runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: dotnet-version: '10.0.x' - name: Publish run: > dotnet publish src/LageBuch.App/LageBuch.App.csproj -r linux-x64 ${{ env.PUBLISH_FLAGS }} -p:Version=${{ needs.version.outputs.version }} -o publish # build-deb.sh renders the hicolor icon sizes with ImageMagick and refuses to build # without it; ubuntu-24.04 runners carry no ImageMagick, rsvg or Inkscape. desktop-file-utils # is only needed so the script's optional entry validation actually runs in CI. - name: Install packaging tools run: | sudo apt-get update sudo apt-get install -y --no-install-recommends imagemagick desktop-file-utils - name: Build .deb run: | chmod +x packaging/linux/build-deb.sh packaging/linux/build-deb.sh \ "${{ needs.version.outputs.version }}" \ publish \ src/LageBuch.App.Shared/Assets/icon-1024.png \ src/LageBuch.App/Assets/icon.svg \ dist - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: deb path: dist/*.deb if-no-files-found: error android: needs: version if: github.event_name == 'push' runs-on: ubuntu-latest steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: dotnet-version: '10.0.x' - name: Setup JDK uses: actions/setup-java@b843ebf9b913146b38da2eaa7aeddf76074ae1ad # v6.1.0 with: distribution: temurin java-version: '21' # Manifest mode, so a half-published workload set cannot block a # release; see the same step in ci.yml. - name: Install Android workload run: | dotnet workload config --update-mode manifests dotnet workload install android - name: Publish run: > dotnet publish src/LageBuch.App.Android/LageBuch.App.Android.csproj -c Release -p:ApplicationVersion=${{ needs.version.outputs.version_code }} -p:ApplicationDisplayVersion=${{ needs.version.outputs.version }} -p:Version=${{ needs.version.outputs.version }} -o publish-android # The publish emits both formats: the .aab, and the universal .apk bundletool extracts # from that same signed bundle. The .apk goes on the release as before; the .aab is kept # as a build artifact for the manual Google Play upload (docs/releasing.md). - name: Locate and rename the packages env: VERSION: ${{ needs.version.outputs.version }} run: | apk=$(find publish-android -name "*-Signed.apk" -o -name "*.apk" | head -n1) aab=$(find publish-android -name "*.aab" | head -n1) test -n "$aab" || { echo "::error::No .aab was produced - check AndroidPackageFormats"; exit 1; } # An SDK default once dropped armeabi-v7a without a word, and Play then hid the app from # every 32-bit tablet. Refuse to release a package missing any ABI the csproj lists. for abi in armeabi-v7a arm64-v8a x86_64; do unzip -l "$apk" "lib/$abi/*" > /dev/null || { echo "::error::The APK has no lib/$abi - check RuntimeIdentifiers"; exit 1; } done # Play automatic protection rejects a bundle whose minSdkVersion is below 24, and 0.7.0 # only found out at the Play upload (#550). The .apk is rendered from the same bundle. aapt2=$(ls -d "$ANDROID_HOME"/build-tools/*/aapt2 | sort -V | tail -n1) min_sdk=$("$aapt2" dump badging "$apk" | sed -n "s/^\(minSdkVersion\|sdkVersion\):'\([0-9]*\)'$/\2/p") test "${min_sdk:-0}" -ge 24 || { echo "::error::The APK has minSdkVersion '${min_sdk}', Play needs 24 - check SupportedOSPlatformVersion"; exit 1; } mkdir -p dist play cp "$apk" "dist/lagebuch-${VERSION}.apk" cp "$aab" "play/lagebuch-${VERSION}.aab" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: apk path: dist/*.apk if-no-files-found: error # Deliberately not a release asset: it is signed with the CI debug key, so it is only good # for inspection. The bundle that goes to Play is built on a laptop with the upload key. - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: aab path: play/*.aab if-no-files-found: error release: needs: [version, windows, linux, android] runs-on: ubuntu-latest # Publish the Windows + Linux installers to the release for the pushed tag. if: github.event_name == 'push' permissions: contents: write # create the release and upload its assets id-token: write # Sigstore needs an OIDC token to sign the provenance attestations: write # and write the signed attestation back to the repo steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 # Only the packages a user installs. Without a pattern this pulls every artifact of the # run, and the CI-debug-signed .aab ended up on the 0.7.0-0.8.1 releases; it is a build # artifact for inspection only (docs/releasing.md). - uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2 with: pattern: '{msi,deb,apk}' path: dist # download-artifact nests each artifact in its own directory (dist/msi/...), # but on the release page the assets sit side by side. Flatten first, so the # checksum file lists the bare names a downloader actually has on disk and # `sha256sum -c SHA256SUMS.txt` works in the download folder. - name: Flatten artifacts and write SHA-256 checksums run: | find dist -mindepth 2 -type f -exec mv -t dist {} + find dist -mindepth 1 -type d -empty -delete # Exactly one of each and nothing else, so a pattern that matches too much or too # little fails here instead of publishing a release with a missing or stray file. ls -l dist for ext in msi deb apk; do test "$(find dist -maxdepth 1 -type f -name "*.$ext" | wc -l)" -eq 1 || { echo "::error::Expected exactly one .$ext in dist/"; exit 1; } done test "$(find dist -maxdepth 1 -type f | wc -l)" -eq 3 || { echo "::error::Unexpected files in dist/ - only .msi, .deb and .apk belong on the release"; exit 1; } cd dist sha256sum -- * > "${RUNNER_TEMP}/SHA256SUMS.txt" mv "${RUNNER_TEMP}/SHA256SUMS.txt" SHA256SUMS.txt cat SHA256SUMS.txt # Sigstore-backed build provenance: proves these exact bytes came out of this # workflow, from this commit. The OS does not know about it, but # `gh attestation verify` does, and it is what a Datenschutzbeauftragter can # check while the packages are still unsigned. - uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: subject-path: | dist/*.msi dist/*.deb dist/*.apk - name: Build release notes env: VERSION: ${{ needs.version.outputs.version }} PRERELEASE: ${{ needs.version.outputs.prerelease }} run: | : > release-notes.md if [ "$PRERELEASE" = "true" ]; then cat >> release-notes.md <<'EOF' > **Vorabversion.** Zum Ausprobieren und für Übungen gedacht — im Einsatz bitte nicht > als einzige Dokumentation verwenden. Rückmeldungen gerne als GitHub-Issue. EOF fi # The changelog is written in English; the release body is German for the # ELW crews who download it, so link the entries rather than inlining them. # No #anchor: GitHub's slug for '## [0.6.0] - 2026-09-16' embeds the release # date. At this tag the version's section is the top one in the file anyway. cat >> release-notes.md < SHA256 # Windows, mit SHA256SUMS.txt vergleichen \`\`\` Die Datei deckt \`.msi\`, \`.deb\` und \`.apk\` ab. Ein \`.dmg\` wird erst nach diesem Release gebaut und bringt seine eigene Prüfsumme mit: \`\`\` shasum -a 256 -c lagebuch-${VERSION}-macos-arm64.dmg.sha256 \`\`\` Jede Installationsdatei trägt zusätzlich einen Sigstore-Herkunftsnachweis aus dem Workflow-Lauf, der sie gebaut hat — prüfbar mit der GitHub CLI: \`\`\` gh attestation verify --repo CodeForFire/lagebuch \`\`\` **Die Pakete sind nicht signiert.** Beim ersten Start: - **Windows**: SmartScreen → *Weitere Informationen* → *Trotzdem ausführen*. - **Linux**: \`sudo apt install ./lagebuch_*.deb\` — bitte \`apt\`, nicht \`dpkg -i\`: das Paket deklariert seine System-Abhängigkeiten, und \`dpkg\` kann diese nicht auflösen (nach einem \`dpkg -i\` hilft \`sudo apt-get -f install\`). - **Android**: aktiviere einmalig *Installation aus unbekannten Quellen* für den Browser/Dateimanager, mit dem die APK geöffnet wird. - **macOS**: Rechtsklick auf Lagebuch.app → *Öffnen* (einmalig bestätigen), oder \`xattr -dr com.apple.quarantine /Applications/Lagebuch.app\`. EOF - uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3 with: tag_name: v${{ needs.version.outputs.version }} name: Lagebuch v${{ needs.version.outputs.version }} # Full releases since 0.5.0: brigades run these builds on real Einsätze, so the # download should be the obvious one. A prerelease tag (v0.6.0-beta.1) flags itself and # leaves the last full release as "Latest". Pre-1.0 either way — see CHANGELOG.md, # breaking changes may land in any release until then. prerelease: ${{ needs.version.outputs.prerelease }} files: dist/* # flat since the checksum step; includes SHA256SUMS.txt body_path: release-notes.md # macOS carries the 10x minute multiplier, so it is not built on every tag. Run this workflow # manually (workflow_dispatch) with the version of an existing release to add the .dmg to it. macos: needs: version if: github.event_name == 'workflow_dispatch' runs-on: macos-latest permissions: contents: write # gh release upload adds the .dmg to an existing release id-token: write # Sigstore needs an OIDC token to sign the provenance attestations: write # and write the signed attestation back to the repo steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0 with: dotnet-version: '10.0.x' - name: Publish run: > dotnet publish src/LageBuch.App/LageBuch.App.csproj -r osx-arm64 ${{ env.PUBLISH_FLAGS }} -p:Version=${{ needs.version.outputs.version }} -o publish - name: Build .dmg run: | chmod +x packaging/macos/build-dmg.sh packaging/macos/build-dmg.sh \ "${{ needs.version.outputs.version }}" \ publish \ src/LageBuch.App.Shared/Assets/icon-1024.png \ dist # Always downloadable from the run; also attach to the matching release if one exists. - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: name: dmg path: dist/*.dmg if-no-files-found: error - uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: subject-path: dist/*.dmg # The .dmg is built after the tag release exists, so it cannot join that # release's SHA256SUMS.txt — it carries its own .sha256 file instead. - name: Attach .dmg to the release env: GH_TOKEN: ${{ github.token }} VERSION: ${{ needs.version.outputs.version }} run: | (cd dist && for f in *.dmg; do shasum -a 256 "$f" > "$f.sha256"; done) if gh release view "v${VERSION}" >/dev/null 2>&1; then gh release upload "v${VERSION}" dist/*.dmg dist/*.dmg.sha256 --clobber else echo "No release v${VERSION} yet — .dmg is available as a workflow artifact only." fi