Skip to content

Commit

Permalink
snap: Fixed determining of the version (mapeditor#3926)
Browse files Browse the repository at this point in the history
When using the 'version: git' approach, only the final snap knows the
version, but it isn't known yet at compile time so Tiled always shows
its version as "git".

Setting fetch-depth to 0 makes it fetch all history for all branches and
tags, which is needed for `git describe` to work.
  • Loading branch information
bjorn authored Apr 18, 2024
1 parent 878a536 commit 8027f07
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set Tiled version
id: version
run: |
sed -i 's/^version: .*/version: '"${TILED_VERSION}"'/g' snap/snapcraft.yaml
if [[ "$TILED_RELEASE" == 'true' ]]; then echo "snap_channel=candidate" >> $GITHUB_OUTPUT ; fi
if [[ "$TILED_RELEASE" != 'true' ]]; then echo "snap_channel=beta" >> $GITHUB_OUTPUT ; fi
Expand Down
10 changes: 6 additions & 4 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: tiled
adopt-info: tiled
version: git
license: GPL-2.0
base: core22

Expand Down Expand Up @@ -44,10 +43,13 @@ apps:
parts:
tiled:
plugin: make
override-pull: |
craftctl default
craftctl set version="$(git describe | sed 's/v//')"
override-build: |
qbs setup-toolchains --detect
qbs build --jobs "${CRAFT_PARALLEL_BUILD_COUNT}" --command-echo-mode command-line config:release qbs.installPrefix:"/usr" projects.Tiled.version:$(craftctl get version) projects.Tiled.useRPaths:false
qbs install --install-root "${CRAFT_PART_INSTALL}" config:release
qbs setup-toolchains --detect
qbs build --jobs "${CRAFT_PARALLEL_BUILD_COUNT}" --command-echo-mode command-line config:release qbs.installPrefix:"/usr" projects.Tiled.version:$(craftctl get version) projects.Tiled.useRPaths:false
qbs install --install-root "${CRAFT_PART_INSTALL}" config:release
parse-info:
- usr/share/metainfo/org.mapeditor.Tiled.appdata.xml
source: .
Expand Down

0 comments on commit 8027f07

Please sign in to comment.