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
25 changes: 19 additions & 6 deletions .github/check-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,17 @@
# but not versionName in android/app/build.gradle. A new version must be
# MAJOR.MINOR.PATCH without leading zeros, greater than the base one, and
# have its section in CHANGELOG.md ("## <version> — YYYY-MM-DD") that the
# base branch does not have yet. android/ counts as app or build (its unit
# tests in android/app/src/test do not); docs, screenshots and the
# workflows in .github/ need no new version. The format is checked only
# when the version changes, so the 2.xx versions before MAJOR.MINOR.PATCH
# stay valid until the next app change.
# base branch does not have yet. android/ (without its unit tests in
# android/app/src/test and its Markdown files) and the build workflow
# .github/workflows/build.yml count as app or build: the workflow holds
# build steps too, and the script cannot tell them from the others. Docs,
# screenshots and the rest of .github/ need no new version.
# NO_RELEASE=true (the pull request's `no-release` label) lets a change to
# the app or the build through without a new version, for changes that
# leave the APKs as they are (a test or publication step in the workflow,
# a comment). The format is checked only when the version changes, so the
# 2.xx versions before MAJOR.MINOR.PATCH stay valid until the next app
# change.
#
# Usage: .github/check-version.sh [BASE] (default origin/v2; CI passes
# HEAD^1, the base side of the pull request's merge commit)
Expand All @@ -33,9 +39,16 @@ ver() {
new=$(ver HEAD < "$gradle")
old=$(git show "$base:$gradle" | ver "$base")

changed=$(git diff --name-only "$base"...HEAD -- android ':(exclude)android/app/src/test')
changed=$(git diff --name-only "$base"...HEAD -- android .github/workflows/build.yml \
':(exclude)android/app/src/test' ':(exclude,glob)**/*.md')
Comment thread
compot-dev marked this conversation as resolved.
Resolved

if [ "$new" = "$old" ]; then
if [ -n "$changed" ] && [ "${NO_RELEASE:-}" = true ]; then
echo "::notice::the app or its build changed, versionName stays $old: the no-release" \
"label says the APKs do not change"
echo "$changed"
exit 0
Comment thread
compot-dev marked this conversation as resolved.
Resolved
fi
if [ -n "$changed" ]; then
echo "::error::the app or its build changed, versionName is still $old:" \
"bump PATCH (fix) or MINOR (feature) and add its CHANGELOG.md section"
Expand Down
10 changes: 8 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ 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:
Expand All @@ -24,8 +26,9 @@ permissions:
contents: read

jobs:
# Pull requests: a change to the app or its build comes with a new versionName
# (MAJOR.MINOR.PATCH) and its CHANGELOG.md section (.github/check-version.sh, #230)
# 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'
Expand All @@ -40,6 +43,9 @@ jobs:
# 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') }}

# Unit tests and lint; also runs for pull requests from forks (no secrets needed)
test:
Expand Down
2 changes: 1 addition & 1 deletion docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) bumps the version as its last commit before the merge: `versionName` by that rule and `versionCode` +1. Docs-only, test-only and CI-only pull requests do not. 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 (`.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.
- 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 (`## <version> — <date>`, 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 <version>`; the notes have one line per branch with its version and commit. Every **new version** (not every build) of `v2` and `basic` is posted to the OpenIPC Telegram channel, where the older builds can be found. Builds of other branches are only workflow artifacts of their runs (90 days).
Expand Down
Loading