Run tests and deploy in one Gitea Actions job
Test and deploy / test-and-deploy (pull_request) Successful in 2m25s

Two jobs meant checking out, setting up Node and running npm ci (and in the
frontend the build) twice, about two minutes each, because every job starts
in a fresh container. Now one job tests and, for pushes to master only,
deploys. The push-to-master condition is spelled out on every deploy step
instead of an env flag compared to 'true', which would skip the deploy
silently and stay green if the boolean were rendered differently. A failed
test still stops the deploy (an if: without a status function implies
success()).

Docs: the one-job layout, and that Jenkins deployed as root - files it left
in an app folder must be chowned to the subscription user before the first
Gitea deploy (hit on the API).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PaddyandClaude Opus 5.5 committed 2026-11-08 22:51:26 +01:00
1 parent 689a485fce
commit b22e89001a
3 files changed
+34 -29

No files matched your search

+7 -5
View File
@@ -7,13 +7,15 @@ real deploy settles them - record the outcome here.
```
push to master ──▶ Gitea ──▶ runner (Docker container on the Plesk server)
├─ test job: npm ci, lint, tsc, test, build
└─ deploy job: build ─ rsync over SSH ─▶ plesk-nachklang@server:<app root>
└─ touch tmp/restart.txt
└─ one job: npm ci, lint, tsc, test, build
└─ (master only) rsync over SSH ─▶ plesk-nachklang@server:<app root>
└─ touch tmp/restart.txt
browser ──https──▶ Plesk (nginx + Passenger) ──▶ <app root>/server.js
```
Pull requests only run the test job.
Pull requests run the same job up to the build; the deploy steps only run for pushes to master.
It used to be two jobs (test, then deploy); since every job starts in a fresh container that meant
`npm ci` and the build twice (~2 min each), so they were merged on 2026-11-08.
## Why SSH and not mounted paths
@@ -155,7 +157,7 @@ to port 3000 if Passenger doesn't intercept.
4. **Back up the Angular build**: download `calendar.nachklang.art/` as a ZIP in Plesk's file
manager. The first deploy replaces those files, and this backup is the quick way back.
5. **Merge** `feature/nextjs-rewrite` into master and watch the run under *Actions*. When the
deploy job has finished, the folder holds the Next app but Plesk still serves it as static
deploy steps have finished, the folder holds the Next app but Plesk still serves it as static
files - **the subdomain is down from here until step 6** (no `index.html` any more).
6. **Step 5 above, right away** - switch the subdomain to the Node app. This is the moment the new
app goes live; doing it right after the run keeps the gap to a few minutes. (Plesk might accept
+9
View File
@@ -62,6 +62,15 @@ Collected during the rewrite (September 2026); the progress log in
an `ssh host 'cmd'` never runs, exit 255). The deploy user uses plain `/bin/bash` instead.
- **SSH is on port 42069**, not 22 (22 is closed); the deploy user is `plesk-nachklang`, not
`nachklang`.
- **Jenkins deployed as root.** Files it copied into an app folder belong to `root:root`, so the
first Gitea deploy (as `plesk-nachklang`) fails with rsync "Operation not permitted" / "Permission
denied". Before switching an app, run `find . ! -user plesk-nachklang` in its folder and
`chown -R plesk-nachklang:psacln` what it lists (hit on the API, 2026-11-08; the calendar folder
only held files directly in a folder the user owned, so deleting them worked).
- **Every Gitea Actions job starts in a fresh container.** Splitting test and deploy into two jobs
repeats checkout, Node setup and `npm ci` (and here the build); one job with the deploy steps
conditioned on push-to-master is faster. Spell the condition out on each step instead of comparing
an env flag to `'true'` - a mismatch there skips the deploy silently and the run stays green.
- **Disable the Jenkins job before merging to master**, or it runs `ng build` on the next push.
## shadcn / Base UI