ci: skip unaffected jobs and rebuilt image versions
- server and client jobs only run when their directory (or shared root files) changed, via a new changes job using dorny/paths-filter - the version job now checks the registry for an existing image tag of the current package.json version instead of diffing against the previous commit's package.json, so the image job is skipped once that version has already been pushed - the image job tolerates server/client being skipped rather than requiring both to succeed
This commit is contained in:
2 files changed
+54
-21
No files matched your search
+5
-3
@@ -245,9 +245,11 @@ Before adding a dependency, check its license is compatible with MIT distributio
|
||||
|
||||
`.gitea/workflows/ci.yml` runs on pushes to `master` and on pull requests:
|
||||
|
||||
- **server**: lint (no warnings allowed), type-check, tests, build.
|
||||
- **client**: lint (no warnings allowed), build, Storybook tests in headless Chromium.
|
||||
- **image** (pushes to `master` only): when the push changes `version` in the root `package.json`, and both check jobs pass, builds the Docker image and pushes it to the Gitea container registry set by `REGISTRY` at the top of the workflow (`git.hq.ars9.space`) as `<registry>/<owner>/<repo>:<version>` and `:latest`.
|
||||
- **changes**: detects which of `server/` and `client/` changed (via `dorny/paths-filter`), also treating root `package.json`/`package-lock.json` and the workflow file itself as affecting both.
|
||||
- **server** (skipped if nothing under `server/` changed): lint (no warnings allowed), type-check, tests, build.
|
||||
- **client** (skipped if nothing under `client/` changed): lint (no warnings allowed), build, Storybook tests in headless Chromium.
|
||||
- **version** (pushes to `master` only): reads `version` from the root `package.json` and checks the registry for an existing `<registry>/<owner>/<repo>:<version>` image; skips the image job if that tag is already present.
|
||||
- **image** (pushes to `master` only): when the version job found no existing image for the current version, and the server/client jobs passed or were skipped, builds the Docker image and pushes it to the Gitea container registry set by `REGISTRY` at the top of the workflow (`git.hq.ars9.space`) as `<registry>/<owner>/<repo>:<version>` and `:latest`.
|
||||
|
||||
The image job logs in as the repository owner with the `REGISTRY_TOKEN` secret: a Gitea access token with package write access (Settings → Applications → token with `write:package`), added under the repository's Settings → Actions → Secrets. It runs `docker` on the runner, so the runner must give jobs access to a Docker daemon (act_runner mounts the host's Docker socket into job containers by default).
|
||||
|
||||
|
||||
Reference in new issue
Block a user