Skip to content

Commit 8f9eac4

Browse files
lklimekclaude
andcommitted
fix(ci): harden plist version validation and use release date for Flatpak
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 45df8c5 commit 8f9eac4

2 files changed

Lines changed: 16 additions & 6 deletions

File tree

.github/workflows/flatpak.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,10 @@ jobs:
4444
echo "::error::Failed to extract version from Cargo.toml"
4545
exit 1
4646
fi
47-
# Use tag date for releases, current date for manual/PR builds
48-
if [ "${{ github.ref_type }}" = "tag" ]; then
47+
# Use release published date when available, tag commit date for tag pushes, current date otherwise
48+
if [ -n "${{ github.event.release.published_at }}" ]; then
49+
DATE=$(echo "${{ github.event.release.published_at }}" | cut -dT -f1)
50+
elif [ "${{ github.ref_type }}" = "tag" ]; then
4951
DATE=$(git log -1 --format=%cs "${{ github.ref }}")
5052
else
5153
DATE=$(date +%Y-%m-%d)

.github/workflows/release.yml

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,12 @@ jobs:
179179
echo "::error::Failed to extract version from Cargo.toml"
180180
exit 1
181181
fi
182-
# Strip prerelease suffix for macOS plist (Apple requires numeric-only)
183-
PLIST_VERSION=$(echo "$VERSION" | sed 's/-.*//')
182+
# Strip prerelease and build metadata suffixes for macOS plist (Apple requires numeric-only)
183+
PLIST_VERSION=$(echo "$VERSION" | sed 's/[-+].*//')
184+
if ! echo "$PLIST_VERSION" | grep -Eq '^[0-9]+(\.[0-9]+){0,2}$'; then
185+
echo "::error::Invalid plist version '$PLIST_VERSION' derived from Cargo version '$VERSION'. Expected numeric x[.y[.z]]."
186+
exit 1
187+
fi
184188
echo "version=$VERSION" >> $GITHUB_OUTPUT
185189
echo "plist_version=$PLIST_VERSION" >> $GITHUB_OUTPUT
186190
echo "Extracted version: $VERSION (plist: $PLIST_VERSION)"
@@ -490,8 +494,12 @@ jobs:
490494
echo "::error::Failed to extract version from Cargo.toml"
491495
exit 1
492496
fi
493-
# Strip prerelease suffix for macOS plist (Apple requires numeric-only)
494-
PLIST_VERSION=$(echo "$VERSION" | sed 's/-.*//')
497+
# Strip prerelease and build metadata suffixes for macOS plist (Apple requires numeric-only)
498+
PLIST_VERSION=$(echo "$VERSION" | sed 's/[-+].*//')
499+
if ! echo "$PLIST_VERSION" | grep -Eq '^[0-9]+(\.[0-9]+){0,2}$'; then
500+
echo "::error::Invalid plist version '$PLIST_VERSION' derived from Cargo version '$VERSION'. Expected numeric x[.y[.z]]."
501+
exit 1
502+
fi
495503
echo "version=$VERSION" >> $GITHUB_OUTPUT
496504
echo "plist_version=$PLIST_VERSION" >> $GITHUB_OUTPUT
497505
echo "Extracted version: $VERSION (plist: $PLIST_VERSION)"

0 commit comments

Comments
 (0)