Use just the commit hash in the branch name and add proper version info

This commit is contained in:
Gunter Labes 2025-02-01 15:06:49 +01:00
parent 4f640801e3
commit 064caa681e
No known key found for this signature in database
GPG Key ID: C0C7B971CC910216
2 changed files with 13 additions and 7 deletions

View File

@ -212,17 +212,22 @@ jobs:
options: --tty --cap-add=ALL --privileged # docker create options
steps:
- { uses: actions/checkout@v4, with: { submodules: "recursive", fetch-depth: 500, fetch-tags: true } }
- { uses: actions/checkout@v4, with: { submodules: "recursive" } }
- name: Flatpak
run: |
# write to an ignored filename so the build is not marked as modified
jq '.modules |= map(select(.name == "wesnoth").sources[0]={type:"dir",path:"."})' packaging/flatpak/org.wesnoth.Wesnoth.json > wesnoth-manifest.json
jq '.modules |= map(if .name == "wesnoth" then ."build-commands"[0]+=" appdata_filepath=org.wesnoth.Wesnoth.appdata.xml" | .sources[0]={type:"dir",path:"."} else . end)' packaging/flatpak/org.wesnoth.Wesnoth.json > wesnoth-manifest.json
git config --global --add safe.directory "$PWD"
branch=ci-$(git describe || git log -n 1 --format=%h) # if git describe fails fall back to the commit hash
flatpak-builder --force-clean --default-branch="$branch" --disable-rofiles-fuse --jobs=2 wesnoth-app wesnoth-manifest.json
flatpak build-export export wesnoth-app "$branch"
flatpak build-bundle export wesnoth.flatpak org.wesnoth.Wesnoth "$branch" --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
branch=ci-$(git log -n 1 --format=%h)
version=$(sed -n 's/#define VERSION "\(.*\)"/\1/p' src/wesconfig.h)
date=$(TZ=UTC0 git log -1 --date=iso-local --format=%cd)
cp packaging/org.wesnoth.Wesnoth.appdata.xml .
# add release info so the flatpak shows the version
utils/update_appdata "$version" org.wesnoth.Wesnoth.appdata.xml "$date"
flatpak-builder --force-clean --disable-rofiles-fuse --jobs=2 wesnoth-app wesnoth-manifest.json
flatpak build-export export-repo wesnoth-app "$branch"
flatpak build-bundle --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo export-repo wesnoth.flatpak org.wesnoth.Wesnoth "$branch"
- name: Upload flatpak bundle
uses: actions/upload-artifact@v4

View File

@ -70,6 +70,7 @@ opts.AddVariables(
PathVariable('fifodir', 'directory for the wesnothd fifo socket file', "/var/run/wesnothd", PathVariable.PathAccept),
BoolVariable('desktop_entry','Clear to disable desktop-entry', True),
BoolVariable('appdata_file','Clear to not install appdata file', True),
PathVariable('appdata_filepath','Path of appdata file to install', "packaging/org.wesnoth.Wesnoth.appdata.xml"),
BoolVariable('systemd','Install systemd unit file for wesnothd', bool(WhereIs("systemctl"))),
PathVariable('datarootdir', 'sets the root of data directories to a non-default location', "share", PathVariable.PathAccept),
PathVariable('datadirname', 'sets the name of data directory', "wesnoth$version_suffix", PathVariable.PathAccept),
@ -790,7 +791,7 @@ if have_client_prereqs and have_X and env["desktop_entry"]:
env.InstallData("icondir", "wesnoth", "packaging/icons")
env.InstallData("desktopdir", "wesnoth", "packaging/org.wesnoth.Wesnoth.desktop")
if have_client_prereqs and "linux" in sys.platform and env["appdata_file"]:
env.InstallData("appdatadir", "wesnoth", "packaging/org.wesnoth.Wesnoth.appdata.xml")
env.InstallData("appdatadir", "wesnoth", env["appdata_filepath"])
# Python tools
env.InstallData("bindir", "pytools", [os.path.join("data", "tools", tool) for tool in pythontools])