mirror of
https://github.com/CCExtractor/ccextractor.git
synced 2026-07-08 18:06:30 +00:00
fix(snap): derive snapcraft version from release tag safely (#2276)
This commit is contained in:
committed by
GitHub
parent
576c727af8
commit
8876d21062
29
.github/workflows/build_snap.yml
vendored
29
.github/workflows/build_snap.yml
vendored
@@ -32,6 +32,35 @@ jobs:
|
||||
- name: Show Snapcraft version
|
||||
run: snapcraft --version
|
||||
|
||||
- name: Set Snap version from tag
|
||||
if: github.event_name == 'release'
|
||||
run: |
|
||||
# Extract version from GITHUB_REF (handles both v0.96.6 and 0.96.6 tags)
|
||||
VERSION="${GITHUB_REF#refs/tags/}"
|
||||
VERSION="${VERSION#v}"
|
||||
VERSION="${VERSION%%-*}"
|
||||
VERSION="${VERSION//[[:space:]]/}"
|
||||
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "ERROR: Version is empty after parsing GITHUB_REF: $GITHUB_REF" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ${#VERSION} -gt 32 ]; then
|
||||
echo "Snap version too long: $VERSION" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Verify snapcraft.yaml has a version line before modifying
|
||||
if ! grep -q '^version:' snap/snapcraft.yaml; then
|
||||
echo "ERROR: No version line found in snap/snapcraft.yaml" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Setting snap version to: $VERSION"
|
||||
sed -i "s/^version: .*/version: '${VERSION}'/" snap/snapcraft.yaml
|
||||
grep -m1 '^version:' snap/snapcraft.yaml
|
||||
|
||||
- name: Build snap
|
||||
run: sudo snapcraft --destructive-mode
|
||||
|
||||
|
||||
Reference in New Issue
Block a user