Refine tag handling in CI/release workflows and publish script to use the v* tag on HEAD, improve error messaging, and update documentation for server configuration adjustments.
ci / image (42, public) (push) Successful in 3m3s
ci / image (42, public) (push) Successful in 3m3s
This commit is contained in:
1 parent
67530d35e9
commit
18ff32b5ce
6 files changed
+28
-18
No files matched your search
@@ -20,7 +20,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# release.sh derives the version from the newest v* tag
|
# release.sh derives the version from the v* tags
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Build and verify
|
- name: Build and verify
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ on:
|
|||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- "v*"
|
- "v*"
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
maven:
|
maven:
|
||||||
@@ -17,7 +16,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# publish.sh derives the version from the newest v* tag
|
# publish.sh derives the version from the v* tag on HEAD
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- uses: actions/setup-java@v4
|
- uses: actions/setup-java@v4
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
# release.sh derives the version from the newest v* tag
|
# release.sh derives the version from the v* tags
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Log in to the registry
|
- name: Log in to the registry
|
||||||
|
|||||||
+10
-3
@@ -69,7 +69,8 @@ game jar for mods that declare `game` versions. Default settings go into
|
|||||||
| `gameJar` | see below | the `projectzomboid.jar` to compile and check against |
|
| `gameJar` | see below | the `projectzomboid.jar` to compile and check against |
|
||||||
| `steamBranch` | `public` | Steam branch for the download: `public`, `unstable`, or a version such as `42.19` |
|
| `steamBranch` | `public` | Steam branch for the download: `public`, `unstable`, or a version such as `42.19` |
|
||||||
| `serverImage` | the ZomboidForge image, `latest` | image for `runServer` |
|
| `serverImage` | the ZomboidForge image, `latest` | image for `runServer` |
|
||||||
| `adminPassword` | `admin` | admin password of the `runServer` server |
|
| `adminPassword` | random, generated once per volume | admin password of the `runServer` server (see below) |
|
||||||
|
| `serverAddress` | `127.0.0.1` | host address `runServer` publishes the game ports on; `0.0.0.0` for the network |
|
||||||
| `dataVolume` | `zomboidforge-<id>` | volume for the `runServer` world and server config |
|
| `dataVolume` | `zomboidforge-<id>` | volume for the `runServer` world and server config |
|
||||||
| `containerEngine` | podman or docker, whichever is installed | for `runServer` and the download |
|
| `containerEngine` | podman or docker, whichever is installed | for `runServer` and the download |
|
||||||
| `deployDirectory` | none | a server's mods directory for `deployMod` |
|
| `deployDirectory` | none | a server's mods directory for `deployMod` |
|
||||||
@@ -104,9 +105,15 @@ The game jar has to be one of the declared `game` versions; the check below fail
|
|||||||
| `modFolder` | `build/mod/<id>/` with `<id>.jar` and `lib/`, as a server expects it in `<forge>/mods` |
|
| `modFolder` | `build/mod/<id>/` with `<id>.jar` and `lib/`, as a server expects it in `<forge>/mods` |
|
||||||
| `modZip` | the same as `build/distributions/<id>-<version>.zip` |
|
| `modZip` | the same as `build/distributions/<id>-<version>.zip` |
|
||||||
| `runServer` | a ZomboidForge server in a container with the mod; Ctrl+C stops it after it saved the world |
|
| `runServer` | a ZomboidForge server in a container with the mod; Ctrl+C stops it after it saved the world |
|
||||||
| `deployMod` | copies the mod folder into `deployDirectory` |
|
| `deployMod` | copies the mod folder into `deployDirectory`; keeps the server's `config.toml` of the mod |
|
||||||
| `downloadGame` | installs the dedicated server for its game jar; runs only when needed |
|
| `downloadGame` | installs the dedicated server for its game jar; runs only when needed |
|
||||||
|
|
||||||
|
`runServer` is reachable from this machine only, unless `serverAddress` says otherwise. Without
|
||||||
|
`adminPassword`, the first run generates a random admin password for the volume, prints it, and
|
||||||
|
keeps it in `<Gradle user home>/zomboidforge/admin-passwords/<volume>`. The server uses the
|
||||||
|
password only when it creates the admin account, on the volume's first start; a later change
|
||||||
|
needs a new volume (`dataVolume`, or remove the old one).
|
||||||
|
|
||||||
### Working on ZomboidForge itself
|
### Working on ZomboidForge itself
|
||||||
|
|
||||||
To build a mod against a local ZomboidForge checkout instead of a published version, include it
|
To build a mod against a local ZomboidForge checkout instead of a published version, include it
|
||||||
@@ -220,7 +227,7 @@ balances.set("player1", new Balance(250, Instant.now()));
|
|||||||
Optional<Balance> balance = balances.get("player1");
|
Optional<Balance> balance = balances.get("player1");
|
||||||
balances.update("player1", old -> new Balance(old.coins() + 10, Instant.now()), () -> new Balance(0, null));
|
balances.update("player1", old -> new Balance(old.coins() + 10, Instant.now()), () -> new Balance(0, null));
|
||||||
|
|
||||||
this.storage().transaction(() -> { // all or nothing
|
this.storage().transaction(() -> { // all or nothing, also when nested
|
||||||
balances.update("player1", old -> new Balance(old.coins() - 5, old.lastPaid()), () -> new Balance(0, null));
|
balances.update("player1", old -> new Balance(old.coins() - 5, old.lastPaid()), () -> new Balance(0, null));
|
||||||
balances.update("player2", old -> new Balance(old.coins() + 5, old.lastPaid()), () -> new Balance(0, null));
|
balances.update("player2", old -> new Balance(old.coins() + 5, old.lastPaid()), () -> new Balance(0, null));
|
||||||
});
|
});
|
||||||
|
|||||||
+5
-5
@@ -2,10 +2,10 @@
|
|||||||
#
|
#
|
||||||
# Publishes the mod API (dev.overlord.zomboidforge:api), the mod tools (mod-tools), and the
|
# Publishes the mod API (dev.overlord.zomboidforge:api), the mod tools (mod-tools), and the
|
||||||
# Gradle plugin (dev.overlord.zomboidforge.mod) to the Maven registry of the ZomboidForge Gitea,
|
# Gradle plugin (dev.overlord.zomboidforge.mod) to the Maven registry of the ZomboidForge Gitea,
|
||||||
# in the version of the newest v* git tag reachable from HEAD, without the "v".
|
# in the version of the v* git tag on HEAD, without the "v".
|
||||||
#
|
#
|
||||||
# A pre-release version (containing "-", e.g. 0.3.0-rc.1) is built and tested but never
|
# A pre-release version (containing "-", e.g. 0.3.0-rc.1) is built and tested but never
|
||||||
# published. Without any v* tag nothing is published.
|
# published. Without a v* tag on HEAD nothing is published.
|
||||||
#
|
#
|
||||||
# Environment:
|
# Environment:
|
||||||
# ORG_GRADLE_PROJECT_giteaUsername Gitea user with package write access
|
# ORG_GRADLE_PROJECT_giteaUsername Gitea user with package write access
|
||||||
@@ -31,11 +31,11 @@ log() {
|
|||||||
echo "[publish] $*" >&2
|
echo "[publish] $*" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prints the newest v* tag reachable from HEAD without its "v", or nothing.
|
# Prints the v* tag on HEAD without its "v", or nothing.
|
||||||
release_tag_version() {
|
release_tag_version() {
|
||||||
local tag
|
local tag
|
||||||
|
|
||||||
if tag="$(git -C "${REPO_ROOT}" describe --tags --abbrev=0 --match 'v*' 2> /dev/null)"; then
|
if tag="$(git -C "${REPO_ROOT}" describe --tags --exact-match --match 'v*' 2> /dev/null)"; then
|
||||||
echo "${tag#v}"
|
echo "${tag#v}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@@ -69,7 +69,7 @@ main() {
|
|||||||
|
|
||||||
version="$(release_tag_version)"
|
version="$(release_tag_version)"
|
||||||
if [[ -z "${version}" ]]; then
|
if [[ -z "${version}" ]]; then
|
||||||
log "No v* git tag found (shallow clone without tags?); nothing to publish."
|
log "HEAD has no v* git tag (not a release commit, or a shallow clone without tags?); nothing to publish."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [[ "${version}" == *-* ]]; then
|
if [[ "${version}" == *-* ]]; then
|
||||||
|
|||||||
+10
-6
@@ -10,9 +10,10 @@
|
|||||||
# <major.minor.build> is the version the branch's server jar reports, read before the full
|
# <major.minor.build> is the version the branch's server jar reports, read before the full
|
||||||
# build (Dockerfile stage game-version, which downloads only the jar).
|
# build (Dockerfile stage game-version, which downloads only the jar).
|
||||||
#
|
#
|
||||||
# <forge> is the newest v* git tag reachable from HEAD, without the "v" (v0.2.0 -> 0.2.0).
|
# <forge> is the v* git tag on HEAD, without the "v" (v0.2.0 -> 0.2.0). When HEAD has no such
|
||||||
# A pre-release version (containing "-", e.g. 0.2.0-rc.1) is built and verified but never
|
# tag, it is the git describe version of HEAD (0.2.0-3-g1a2b3c4: 3 commits after v0.2.0).
|
||||||
# published. Without any v* tag the version is "0.0.0-prerelease".
|
# A pre-release version (containing "-", e.g. 0.2.0-rc.1 or 0.2.0-3-g1a2b3c4) is built and
|
||||||
|
# verified but never published. Without any v* tag the version is "0.0.0-prerelease".
|
||||||
#
|
#
|
||||||
# Nothing is built when <forge>-pz<major.minor.build> already exists in the registry. The
|
# Nothing is built when <forge>-pz<major.minor.build> already exists in the registry. The
|
||||||
# server only admits clients with the same major.minor.build, so every hotfix (42.21.1 ->
|
# server only admits clients with the same major.minor.build, so every hotfix (42.21.1 ->
|
||||||
@@ -69,12 +70,15 @@ gradle_property() {
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prints the forge version: the newest v* tag reachable from HEAD without its "v",
|
# Prints the forge version without the "v": the v* tag on HEAD, else the git describe version
|
||||||
# or nothing when the repository has no such tag.
|
# of HEAD relative to the newest reachable v* tag (v0.2.0-3-g1a2b3c4), or nothing when the
|
||||||
|
# repository has no such tag.
|
||||||
release_tag_version() {
|
release_tag_version() {
|
||||||
local tag
|
local tag
|
||||||
|
|
||||||
if tag="$(git -C "${REPO_ROOT}" describe --tags --abbrev=0 --match 'v*' 2> /dev/null)"; then
|
if tag="$(git -C "${REPO_ROOT}" describe --tags --exact-match --match 'v*' 2> /dev/null)"; then
|
||||||
|
echo "${tag#v}"
|
||||||
|
elif tag="$(git -C "${REPO_ROOT}" describe --tags --match 'v*' 2> /dev/null)"; then
|
||||||
echo "${tag#v}"
|
echo "${tag#v}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user