Skip to content

Commit 84f7ed8

Browse files
committed
snap: fix version from tag
1 parent 2e4396a commit 84f7ed8

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

.github/workflows/snapstore.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
with:
1616
fetch-depth: 0
1717

18+
- name: Write VERSION
19+
run: echo "${GITHUB_REF_NAME}" > VERSION
20+
1821
- name: Build snap
1922
id: build
2023
uses: snapcore/action-build@v1

snap/snapcraft.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ parts:
2929
- requirements.txt
3030
override-pull: |
3131
craftctl default
32-
if [ -n "${GITHUB_REF_NAME:-}" ]; then
33-
craftctl set version="${GITHUB_REF_NAME}"
34-
elif command -v git >/dev/null 2>&1; then
35-
craftctl set version="$(git describe --tags --long --always 2>/dev/null || git rev-parse --short HEAD)"
32+
if [ -f "${CRAFT_PROJECT_DIR:-.}/VERSION" ]; then
33+
craftctl set version="$(cat "${CRAFT_PROJECT_DIR:-.}/VERSION")"
34+
elif [ -f "${CRAFT_PART_SRC}/VERSION" ]; then
35+
craftctl set version="$(cat "${CRAFT_PART_SRC}/VERSION")"
3636
else
3737
craftctl set version="0+unknown"
3838
fi

0 commit comments

Comments
 (0)