Skip to content

Commit bba83d3

Browse files
committed
snap: Properly fetch and get tags
Also fall back if there's no tag Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 8cf6fd9 commit bba83d3

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

.github/workflows/package.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ jobs:
7474
runs-on: ubuntu-24.04
7575
steps:
7676
- uses: actions/checkout@v6
77+
with:
78+
fetch-depth: 0
7779

7880
- name: Build snap
7981
uses: snapcore/action-build@v1

snap/snapcraft.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ parts:
3535
override-pull: |
3636
craftctl default
3737
VERSION=$(craftctl get version)
38-
if [ -z $VERSION ]; then
39-
VERSION=$(git describe --tags --abbrev=10)
40-
craftctl set version=$VERSION
38+
if [ -z "$VERSION" ]; then
39+
VERSION=$(git describe --tags --abbrev=10 2>/dev/null || echo "0.0.0+git$(git rev-parse --short=10 HEAD)")
40+
craftctl set version="$VERSION"
4141
fi
4242
override-build: |
4343
cd "${CRAFT_PART_SRC}"

0 commit comments

Comments
 (0)