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
5 changes: 3 additions & 2 deletions .github/check-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
# leave the release files as they are (a test or publication step in the
# workflow, a build-script tidy-up, a comment).
#
# Usage: .github/check-version.sh [BASE] (default origin/master; CI passes
# HEAD^1, the base side of the pull request's merge commit)
# Usage: .github/check-version.sh [BASE] (default origin/master; CI,
# .github/workflows/version.yml, passes HEAD^1, the base side of the pull
# request's merge commit; version.yml itself is CI, not build)
#

set -eu
Expand Down
24 changes: 4 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
# on x86_64; plus the static musl builds the release ships: x86_64
# (ci/build-static.sh) and soft-float mipsel for OpenWrt routers
# (ci/build-mipsel.sh).
# On pull requests, .github/check-version.sh checks that a change to the
# code or the build (this workflow included) comes with a new
# On pull requests, version.yml runs .github/check-version.sh: a change to
# the code or the build (this workflow included) comes with a new
# PROGRAM_VERSION and its CHANGELOG.md section; the no-release label lets
# a change that keeps the release files as they are through without one.
# Only the head of master publishes, so a re-run of an older run never
Expand All @@ -25,8 +25,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:

# The build only reads the repository and uploads artifacts.
Expand All @@ -41,22 +39,8 @@ concurrency:
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
version:
name: Version bump
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0

# The checkout is the merge commit; its first parent is the base it was made from.
- name: Code changes come with a new version
env:
# a change that leaves the release files as they are may skip the new version
NO_RELEASE: ${{ contains(github.event.pull_request.labels.*.name, 'no-release') }}
run: .github/check-version.sh HEAD^1
# The version check of pull requests runs in version.yml: a label change
# re-runs only that check, not the builds.

linux:
name: Linux ${{ matrix.platform.name }}
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#
# Copyright (c) OpenIPC https://openipc.org MIT License
#
# version.yml — the version check of pull requests (#42, #64, #66)
#
# A change to the code or the build (build.yml included) comes with a new
# PROGRAM_VERSION (MAJOR.MINOR.PATCH) and its CHANGELOG.md section, unless
# the no-release label says the release files do not change. A workflow of
# its own: adding or removing a label re-runs this check, not the builds.
#

name: Version

on:
pull_request:
# 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@v6
with:
fetch-depth: 0

# The checkout is the merge commit; its first parent is the base it was made from.
- name: Code changes come with a new version
env:
# a change that leaves the release files as they are may skip the new version
NO_RELEASE: ${{ contains(github.event.pull_request.labels.*.name, 'no-release') }}
run: .github/check-version.sh HEAD^1
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,12 @@ The change history of every version is in [CHANGELOG.md](CHANGELOG.md).
Versions are `MAJOR.MINOR.PATCH` (`PROGRAM_VERSION` in `vectis.c`): 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. A pull request that changes the code or the build (the
sources, the `Makefile`, `ci/`) raises the version as its last commit before the merge,
together with its `CHANGELOG.md` section. Changes to the docs, tests, screenshots or the
workflows in `.github/` do not. CI checks this on every pull request
(`.github/check-version.sh`).
sources, the `Makefile`, `ci/`, the build workflow `.github/workflows/build.yml`) raises the
version as its last commit before the merge, together with its `CHANGELOG.md` section.
Changes to the docs, tests, screenshots or the other workflows in `.github/` do not; a change
to the code or the build that leaves the release files as they are takes the `no-release`
label instead of a new version. CI checks this on every pull request
(`.github/check-version.sh`, run by `.github/workflows/version.yml`).

## Hardware

Expand Down
8 changes: 5 additions & 3 deletions README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,11 @@ ci/build-mipsel.sh
Версия — `MAJOR.MINOR.PATCH` (`PROGRAM_VERSION` в `vectis.c`): PATCH — исправления и мелкие
правки, MINOR — новая возможность, MAJOR — несовместимое изменение или крупное обновление,
только по решению сопровождающего. PR, который меняет код или сборку (исходники, `Makefile`,
`ci/`), поднимает версию последним коммитом перед мержем вместе с её разделом в
`CHANGELOG.md`. Правки документации, тестов, скриншотов и workflow в `.github/` версию не
поднимают. CI проверяет это в каждом PR (`.github/check-version.sh`).
`ci/`, workflow сборки `.github/workflows/build.yml`), поднимает версию последним коммитом
перед мержем вместе с её разделом в `CHANGELOG.md`. Правки документации, тестов, скриншотов и
остальных workflow в `.github/` версию не поднимают; правка кода или сборки, после которой
файлы релиза не меняются, получает метку `no-release` вместо новой версии. CI проверяет это в
каждом PR (`.github/check-version.sh`, его запускает `.github/workflows/version.yml`).

## Оборудование

Expand Down
8 changes: 5 additions & 3 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,11 @@ ci/build-mipsel.sh

版本号格式为 `MAJOR.MINOR.PATCH`(`vectis.c` 中的 `PROGRAM_VERSION`):PATCH 表示修复和小改动,
MINOR 表示新功能,MAJOR 表示不兼容的变更或大规模更新,仅由维护者决定。修改代码或构建
(源代码、`Makefile`、`ci/`)的 PR 需要在合并前的最后一个提交中提升版本号,并在
`CHANGELOG.md` 中添加对应章节。仅修改文档、测试、截图或 `.github/` 中工作流的 PR 不提升
版本号。CI 会在每个 PR 中检查这一点(`.github/check-version.sh`)。
(源代码、`Makefile`、`ci/`、构建工作流 `.github/workflows/build.yml`)的 PR 需要在合并前的
最后一个提交中提升版本号,并在 `CHANGELOG.md` 中添加对应章节。仅修改文档、测试、截图或
`.github/` 中其他工作流的 PR 不提升版本号;修改代码或构建但发布文件不变的 PR 打上
`no-release` 标签,代替新版本号。CI 会在每个 PR 中检查这一点(`.github/check-version.sh`,
由 `.github/workflows/version.yml` 运行)。

## 硬件

Expand Down
Loading