From bf1426622b47f4a4a431da479e853c943a63ebf6 Mon Sep 17 00:00:00 2001 From: Compot Developer Date: Sun, 18 Oct 2026 13:59:13 +0000 Subject: [PATCH] ci: the version check runs in a workflow of its own (#244) Adding or removing a label re-ran the whole build, because build.yml listened to labeled/unlabeled for the version check. The check moves to .github/workflows/version.yml, the only workflow on label events; build.yml runs on the usual pull request events again. --- .github/check-version.sh | 4 ++++ .github/workflows/build.yml | 23 +------------------- .github/workflows/version.yml | 41 +++++++++++++++++++++++++++++++++++ docs/testing.md | 2 +- 4 files changed, 47 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/version.yml diff --git a/.github/check-version.sh b/.github/check-version.sh index 5d27bdf..9f3ef8a 100755 --- a/.github/check-version.sh +++ b/.github/check-version.sh @@ -16,6 +16,10 @@ # 2.xx versions before MAJOR.MINOR.PATCH stay valid until the next app # change. # +# CI runs it from .github/workflows/version.yml (#244), a workflow of its own +# that also re-runs on a label change; version.yml and publish-latest.sh are +# CI, not build. +# # Usage: .github/check-version.sh [BASE] (default origin/v2; CI passes # HEAD^1, the base side of the pull request's merge commit) # diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9f3877d..46253d6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,8 +2,6 @@ name: Build on: push: pull_request: - # labeled / unlabeled: the version check reads the no-release label - types: [opened, synchronize, reopened, labeled, unlabeled] workflow_dispatch: inputs: commit_hash: @@ -26,26 +24,7 @@ permissions: contents: read jobs: - # Pull requests: a change to the app or its build (android/, this workflow) comes with a new - # versionName (MAJOR.MINOR.PATCH) and its CHANGELOG.md section (.github/check-version.sh, #230); - # the no-release label lets a change that keeps the APKs as they are through without one (#239) - version: - # basic keeps its own workflow and version file (app/build.gradle) - if: github.event_name == 'pull_request' && github.base_ref == 'v2' - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # The checkout is the pull request's merge commit: its first parent is the - # base it was made from, so both versions come from the same base. - - name: App changes come with a new version - run: .github/check-version.sh HEAD^1 - env: - # a change that leaves the APKs as they are may skip the new version - NO_RELEASE: ${{ contains(github.event.pull_request.labels.*.name, 'no-release') }} + # The version check of pull requests is .github/workflows/version.yml (#244). # Unit tests and lint; also runs for pull requests from forks (no secrets needed) test: diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml new file mode 100644 index 0000000..19cba42 --- /dev/null +++ b/.github/workflows/version.yml @@ -0,0 +1,41 @@ +# version.yml — the version check of pull requests to v2 (#230, #239, #244) +# +# A change to the app or its build (android/, build.yml) comes with a new +# versionName (MAJOR.MINOR.PATCH) and its CHANGELOG.md section, unless the +# no-release label says the APKs do not change. A workflow of its own: +# adding or removing a label re-runs this check, not the build. basic keeps +# its own workflow and version file (app/build.gradle). + +name: Version + +on: + pull_request: + branches: [v2] + # labeled / unlabeled: the check reads the no-release label + types: [opened, synchronize, reopened, labeled, unlabeled] + +permissions: + contents: read + +# a newer event of the same pull request cancels the older check +concurrency: + group: version-${{ github.ref }} + cancel-in-progress: true + +jobs: + version: + name: Version bump + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + # The checkout is the pull request's merge commit: its first parent is the + # base it was made from, so both versions come from the same base. + - name: App changes come with a new version + run: .github/check-version.sh HEAD^1 + env: + # a change that leaves the APKs as they are may skip the new version + NO_RELEASE: ${{ contains(github.event.pull_request.labels.*.name, 'no-release') }} diff --git a/docs/testing.md b/docs/testing.md index 716b3ea..96786d7 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -47,7 +47,7 @@ CI is the reference: the project does not depend on local builds. ## Versions and releases -- Versions are **`MAJOR.MINOR.PATCH`** (`versionName` in `android/app/build.gradle`): PATCH for fixes and small changes, MINOR for a new feature, MAJOR for an incompatible change or a large update, only when the maintainer decides. Every pull request that changes the app or its build (`android/`, except the unit tests and Markdown files, and `.github/workflows/build.yml`, which holds build steps) bumps the version as its last commit before the merge: `versionName` by that rule and `versionCode` +1. Docs-only and test-only pull requests do not. A pull request that changes the app or the build but not the APKs (a test or publication step in the workflow, a comment) takes the `no-release` label instead and keeps the version. Numbers are not reserved for open pull requests: each one takes the next number when it is merged. CI checks this on every pull request (`.github/check-version.sh`): a new number must be canonical (no leading zeros), greater than the base one, and come with its own `CHANGELOG.md` section. +- Versions are **`MAJOR.MINOR.PATCH`** (`versionName` in `android/app/build.gradle`): PATCH for fixes and small changes, MINOR for a new feature, MAJOR for an incompatible change or a large update, only when the maintainer decides. Every pull request that changes the app or its build (`android/`, except the unit tests and Markdown files, and `.github/workflows/build.yml`, which holds build steps) bumps the version as its last commit before the merge: `versionName` by that rule and `versionCode` +1. Docs-only and test-only pull requests do not. A pull request that changes the app or the build but not the APKs (a test or publication step in the workflow, a comment) takes the `no-release` label instead and keeps the version. Numbers are not reserved for open pull requests: each one takes the next number when it is merged. CI checks this on every pull request to `v2` (`.github/check-version.sh` in the `version` workflow, `.github/workflows/version.yml`; adding or removing a label re-runs only this check, not the build): a new number must be canonical (no leading zeros), greater than the base one, and come with its own `CHANGELOG.md` section. - Until 2.17 `v2` counted **2.xx** (+0.01 per pull request); 2.17 is followed by 2.17.1 or 2.18.0. `basic` keeps its 1.7.x line (1.07.1 is 1.7.1). - **`CHANGELOG.md`** is the change history: the version bump commit of a pull request that changes the app adds the version's section (`## — `, newest first) in the same pull request. - Development is continuous, so there is **no release per version** (#194). The one release, [`latest`](https://github.com/OpenIPC/decoder/releases/latest), holds the newest `v2` and `basic` builds and is updated in place by both (`.github/publish-latest.sh`, #229): each branch replaces only its own files; a `v2` build moves the `latest` tag to the commit it built and sets the title `Decoder `; the notes have one line per branch with its version and commit. The APK of every **new `v2` version** (not every build) is posted to the OpenIPC Telegram channel, where the older builds can be found; `basic` posts nothing there. Builds of other branches are only workflow artifacts of their runs (90 days).