Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
name: Android

on:
push:
branches: [main]
paths:
- "android/**"
- "crates/ezd-android/**"
- "crates/ezd-client-core/**"
- "crates/ezd-proto/**"
- "crates/ezd-link/**"
- ".github/workflows/android.yml"
# Pushes to main run through the release workflow, which calls this one.
pull_request:
paths:
- "android/**"
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: CI

on:
push:
branches: [main]
# Pushes to main run through the release workflow, which calls this one.
pull_request:
workflow_call:

Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/linux-packages.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Linux packages

on:
push:
branches: [main]
# Pushes to main run through the release workflow, which calls this one.
pull_request:
# Called by the release workflow.
workflow_call:
Expand Down
69 changes: 48 additions & 21 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Release

# Push a tag `v<workspace version>` (see docs/releasing.md) to build everything and publish a
# GitHub Release. "Run workflow" with dry_run builds the same set and uploads it as the
# `release-preview` artifact without creating a release.
# Every push to main publishes a GitHub pre-release tagged `v<workspace version>+<run number>`.
# Pushing a tag `v<workspace version>` (see docs/releasing.md) publishes the release of that version.
# "Run workflow" with dry_run builds the same set and uploads it as the `release-preview` artifact
# without creating a release.
on:
push:
branches: [main]
tags: ["v*"]
workflow_dispatch:
inputs:
Expand All @@ -16,6 +18,11 @@ on:
permissions:
contents: read

# Releases of different pushes never cancel each other.
concurrency:
group: release-${{ github.ref }}
cancel-in-progress: false

env:
CARGO_TERM_COLOR: always

Expand All @@ -25,18 +32,43 @@ jobs:
runs-on: ubuntu-24.04
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
mode: ${{ steps.version.outputs.mode }}
steps:
- uses: actions/checkout@v4
- id: version
env:
DRY_RUN: ${{ inputs.dry_run }}
run: |
version=$(sed -n '/^\[workspace\.package\]/,/^\[/{s/^version *= *"\(.*\)"/\1/p}' Cargo.toml)
[ -n "$version" ] || { echo "cannot read the workspace version from Cargo.toml"; exit 1; }
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Workspace version: $version"
if [ "$GITHUB_REF_TYPE" = tag ] && [ "$GITHUB_REF_NAME" != "v$version" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match the workspace version (expected v$version)"
# mode: release (a v* tag), prerelease (a push to main) or preview (no release).
if [ "$GITHUB_REF_TYPE" = tag ]; then
if [ "$GITHUB_REF_NAME" != "v$version" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match the workspace version (expected v$version)"
exit 1
fi
tag=$GITHUB_REF_NAME
if [ "$GITHUB_EVENT_NAME" = push ] || [ "$DRY_RUN" = false ]; then mode=release; else mode=preview; fi
elif [ "$GITHUB_EVENT_NAME" = push ] && [ "$GITHUB_REF" = refs/heads/main ]; then
tag="v$version+$GITHUB_RUN_NUMBER"
mode=prerelease
if git ls-remote --exit-code --tags origin "refs/tags/$tag" >/dev/null; then
echo "$tag already exists, building a preview only"
mode=preview
fi
elif [ "$GITHUB_EVENT_NAME" = workflow_dispatch ] && [ "$DRY_RUN" = false ]; then
echo "::error::a real release needs a tag: run the workflow on a v* tag, not on $GITHUB_REF_NAME"
exit 1
else
tag=
mode=preview
fi
echo "tag=$tag" >> "$GITHUB_OUTPUT"
echo "mode=$mode" >> "$GITHUB_OUTPUT"
echo "Tag: ${tag:-none}, mode: $mode"

ci:
name: CI
Expand All @@ -61,20 +93,10 @@ jobs:
contents: write
env:
VERSION: ${{ needs.version.outputs.version }}
DRY_RUN: ${{ inputs.dry_run }}
TAG: ${{ needs.version.outputs.tag }}
MODE: ${{ needs.version.outputs.mode }}
GH_TOKEN: ${{ github.token }}
steps:
- name: Decide between release and preview
id: mode
run: |
if [ "$GITHUB_REF_TYPE" = tag ] && { [ "$GITHUB_EVENT_NAME" = push ] || [ "$DRY_RUN" = false ]; }; then
echo "release=true" >> "$GITHUB_OUTPUT"
elif [ "$GITHUB_EVENT_NAME" = workflow_dispatch ] && [ "$DRY_RUN" = false ]; then
echo "::error::a real release needs a tag: run the workflow on a v* tag, not on $GITHUB_REF_NAME"
exit 1
else
echo "release=false" >> "$GITHUB_OUTPUT"
fi
- uses: actions/download-artifact@v4
with:
pattern: ezdisplay-*
Expand Down Expand Up @@ -109,14 +131,19 @@ jobs:
ls -l release
cat release/SHA256SUMS
- name: Create the GitHub Release
if: steps.mode.outputs.release == 'true'
if: env.MODE == 'release'
run: |
prerelease=
case "$GITHUB_REF_NAME" in *-*) prerelease=--prerelease ;; esac
gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" --verify-tag \
case "$TAG" in *-*) prerelease=--prerelease ;; esac
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --verify-tag \
--title "ezdisplay $VERSION" --generate-notes $prerelease release/*
- name: Create the GitHub pre-release of this build
if: env.MODE == 'prerelease'
run: |
gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --target "$GITHUB_SHA" \
--title "ezdisplay $VERSION (build $GITHUB_RUN_NUMBER)" --generate-notes --prerelease release/*
- name: Upload the preview
if: steps.mode.outputs.release != 'true'
if: env.MODE == 'preview'
uses: actions/upload-artifact@v4
with:
name: release-preview
Expand Down
9 changes: 9 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,12 @@ These rules apply to the whole repository. Component notes live next to the code
Do not name pen-tablet vendors or commercial drawing apps in code, strings, docs, tests or commit messages; describe
the behaviour instead (for example "graphics tablet", "drawing apps"). The platforms the app runs on or talks to
(Android, Samsung and the S Pen, KDE, Windows) and open-source apps used as test examples (Krita) are fine.

## Versioning
- The version is `version` in `[workspace.package]` of the root `Cargo.toml` (crates, packages and the Android app
follow it). Every push to `main` publishes a GitHub pre-release `v<version>+<run number>`; a `vX.Y.Z` tag publishes
the release (see `docs/releasing.md`).
- Bump the version in its own commit (`Bump the version to X.Y.Z`, with `cargo update -w` for `Cargo.lock`) before
every tagged release; never tag a release under the previous version. Patch (`x.y.Z`) for fixes and small,
self-contained changes (including a single small feature), minor (`x.Y.0`) for medium changes (several features, a
reworked screen or flow), major (`X.0.0`) for a large overhaul; keep the pre-release suffix (`-alpha`).
26 changes: 13 additions & 13 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ resolver = "3"
members = ["crates/*"]

[workspace.package]
version = "0.1.0-alpha.1"
version = "0.2.0-alpha"
edition = "2024"
license = "MIT OR Apache-2.0"
authors = ["LibreStatic"]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ and no telemetry, and everything travels through the cable.

## Status

ezdisplay is in **alpha** ([`v0.1.0-alpha.1`](https://github.com/LibreStatic/ezdisplay/releases)).
ezdisplay is in **alpha** (see the [releases](https://github.com/LibreStatic/ezdisplay/releases); every change merged to `main` is published as a pre-release).
Working today, over USB with ADB:

| | Windows | KDE Plasma 6 (Wayland) |
Expand Down
34 changes: 23 additions & 11 deletions docs/releasing.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
# Releasing

A release is a `vX.Y.Z` tag. The *Release* workflow builds every package from that commit and
publishes them in one GitHub Release.
The *Release* workflow builds every package from one commit and publishes them in one GitHub Release:

- **Every push to `main`** publishes a pre-release tagged `v<version>+<run number>` (for example
`v0.2.0-alpha+57`), so each merged change can be tried at once. The tag is created by the release.
- **A `vX.Y.Z` tag** publishes the release of that version. Tags containing `-` (for example
`v0.2.0-alpha`) are published as pre-releases. The workflow fails at once if the tag does not
match the workspace version.

## Versioning

The version is `version` in `[workspace.package]` of the root `Cargo.toml`; every crate, the
packages and the Android app (`versionName`, and `versionCode` derived from it) follow it. Bump it
in its own commit (`Bump the version to X.Y.Z`) before tagging a release, choosing the part by the
size of the changes since the last release: patch (`x.y.Z`) for fixes and small, self-contained
changes (including a single small feature), minor (`x.Y.0`) for medium changes (several features, a
reworked screen or flow), major (`X.0.0`) for a large overhaul. Keep the pre-release suffix
(`-alpha`) while the project is in alpha. Never tag a release under the previous version.

## Steps

1. Bump `version` in `[workspace.package]` of the root `Cargo.toml` (every crate follows it) and run
`cargo check --workspace` so `Cargo.lock` is updated. Merge that to `main`.
1. Bump the version as above and run `cargo update -w` so `Cargo.lock` follows. Merge that to
`main` (which also publishes a pre-release of it).
2. Optional dry run: *Actions, Release, Run workflow* on `main` with `dry_run` ticked (the default).
It runs the whole pipeline and uploads the files as the `release-preview` artifact, without
creating a release.
Expand All @@ -17,18 +32,15 @@ publishes them in one GitHub Release.
git push origin vX.Y.Z
```

Tags containing `-` (for example `v0.2.0-rc1`) are published as pre-releases. The workflow
fails at once if the tag does not match the workspace version.

## What the workflow does

| Job | What it does |
| --- | --- |
| `version` | Reads the workspace version and checks it against the tag. |
| `version` | Reads the workspace version, checks it against the tag and picks the tag of a `main` pre-release (skipped if that tag already exists). |
| `ci` | Calls `ci.yml`: fmt, clippy and tests on Linux, the Windows build and installer (`ezdisplay-windows-installer`). |
| `android` | Calls `android.yml`: the APKs (`ezdisplay-android-apks`). |
| `linux` | Calls `linux-packages.yml`: the Arch package (`ezdisplay-arch`), one `.deb` per distro (`ezdisplay-deb-ubuntu24.04`, `-debian13`, `-ubuntu26.04`), the AppImage (`ezdisplay-appimage`) and its sources (`ezdisplay-appimage-sources`), plus a smoke test of the AppImage on a clean Debian 13. |
| `publish` | Runs only when all of the above pass. Collects the release files, writes `SHA256SUMS` and creates the release with generated notes (or uploads `release-preview` on a dry run). |
| `publish` | Runs only when all of the above pass. Collects the release files, writes `SHA256SUMS` and creates the release or the `main` pre-release with generated notes (or uploads `release-preview` on a dry run or when the pre-release tag already exists). |

The release assets are:

Expand All @@ -40,8 +52,8 @@ The release assets are:
- `ezdisplay-<version>-full-debug.apk` and `ezdisplay-<version>-play-debug.apk`;
- `SHA256SUMS`.

The same workflows also run on every push to `main` and on pull requests; the artifacts of those
runs are the way to try a build before tagging.
Pull requests run `ci.yml`, `android.yml` and `linux-packages.yml` on their own; their artifacts are
the way to try a change before it is merged. On `main` those workflows run only through *Release*.

## GPL obligations of the AppImage

Expand Down
Loading