Skip to content

Commit 52fea89

Browse files
0.4.0 - Implement proper version validation instead of auto-updating
- Replace automatic Cargo.toml updating with version validation - Require developers to manually update Cargo.toml version - Validate that commit message version matches Cargo.toml version - Fail build if versions don't match (prevents inconsistent releases) - Use 'dig-network' installation directory instead of 'Digstore' - Update macOS app bundle name to 'DIG Network Digstore.app' - Enforce proper release discipline with manual version management Release process now requires: 1. Update Cargo.toml version manually 2. Commit with matching version in message 3. System validates consistency before building
1 parent 4ba33ff commit 52fea89

File tree

3 files changed

+72
-28
lines changed

3 files changed

+72
-28
lines changed

.github/workflows/build-installers.yml

Lines changed: 51 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,31 @@ jobs:
2222
steps:
2323
- uses: actions/checkout@v4
2424

25-
- name: Extract and set version
25+
- name: Validate version consistency
2626
run: |
2727
# Extract version from commit message (e.g., "Release 1.2.3" -> "1.2.3")
2828
$COMMIT_MSG = "${{ github.event.head_commit.message }}"
29-
$VERSION = [regex]::Match($COMMIT_MSG, '[0-9]+\.[0-9]+\.[0-9]+').Value
30-
Write-Host "Detected version: $VERSION"
29+
$COMMIT_VERSION = [regex]::Match($COMMIT_MSG, '[0-9]+\.[0-9]+\.[0-9]+').Value
30+
Write-Host "Version in commit message: $COMMIT_VERSION"
3131
32-
if ([string]::IsNullOrEmpty($VERSION)) {
32+
if ([string]::IsNullOrEmpty($COMMIT_VERSION)) {
3333
Write-Host "No version found in commit message, skipping"
3434
exit 1
3535
}
3636
37-
# Update Cargo.toml with the EXACT version from commit message (no auto-increment)
38-
(Get-Content Cargo.toml) -replace '^version = ".*"', "version = `"$VERSION`"" | Set-Content Cargo.toml
39-
Write-Host "Updated Cargo.toml to EXACT version $VERSION (from commit message)"
37+
# Check that Cargo.toml version matches commit message
38+
$CARGO_VERSION = (Select-String -Path "Cargo.toml" -Pattern '^version = "([^"]+)"').Matches[0].Groups[1].Value
39+
Write-Host "Version in Cargo.toml: $CARGO_VERSION"
40+
41+
if ($CARGO_VERSION -ne $COMMIT_VERSION) {
42+
Write-Host "ERROR: Version mismatch!"
43+
Write-Host " Commit message version: $COMMIT_VERSION"
44+
Write-Host " Cargo.toml version: $CARGO_VERSION"
45+
Write-Host "Please update Cargo.toml version to match commit message before releasing."
46+
exit 1
47+
}
48+
49+
Write-Host "✓ Version consistency validated: $COMMIT_VERSION"
4050
4151
- name: Install Rust
4252
uses: dtolnay/rust-toolchain@stable
@@ -196,21 +206,31 @@ jobs:
196206
steps:
197207
- uses: actions/checkout@v4
198208

199-
- name: Extract and set version
209+
- name: Validate version consistency
200210
run: |
201211
# Extract version from commit message (e.g., "Release 1.2.3" -> "1.2.3")
202212
COMMIT_MSG="${{ github.event.head_commit.message }}"
203-
VERSION=$(echo "$COMMIT_MSG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
204-
echo "Detected version: $VERSION"
213+
COMMIT_VERSION=$(echo "$COMMIT_MSG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
214+
echo "Version in commit message: $COMMIT_VERSION"
205215
206-
if [ -z "$VERSION" ]; then
216+
if [ -z "$COMMIT_VERSION" ]; then
207217
echo "No version found in commit message, skipping"
208218
exit 1
209219
fi
210220
211-
# Update Cargo.toml with the EXACT version from commit message (no auto-increment)
212-
sed -i '' "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
213-
echo "Updated Cargo.toml to EXACT version $VERSION (from commit message)"
221+
# Check that Cargo.toml version matches commit message
222+
CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | cut -d '"' -f 2)
223+
echo "Version in Cargo.toml: $CARGO_VERSION"
224+
225+
if [ "$CARGO_VERSION" != "$COMMIT_VERSION" ]; then
226+
echo "ERROR: Version mismatch!"
227+
echo " Commit message version: $COMMIT_VERSION"
228+
echo " Cargo.toml version: $CARGO_VERSION"
229+
echo "Please update Cargo.toml version to match commit message before releasing."
230+
exit 1
231+
fi
232+
233+
echo "✓ Version consistency validated: $COMMIT_VERSION"
214234
215235
- name: Install Rust
216236
uses: dtolnay/rust-toolchain@stable
@@ -290,21 +310,31 @@ jobs:
290310
steps:
291311
- uses: actions/checkout@v4
292312

293-
- name: Extract and set version
313+
- name: Validate version consistency
294314
run: |
295315
# Extract version from commit message (e.g., "Release 1.2.3" -> "1.2.3")
296316
COMMIT_MSG="${{ github.event.head_commit.message }}"
297-
VERSION=$(echo "$COMMIT_MSG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
298-
echo "Detected version: $VERSION"
317+
COMMIT_VERSION=$(echo "$COMMIT_MSG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
318+
echo "Version in commit message: $COMMIT_VERSION"
299319
300-
if [ -z "$VERSION" ]; then
320+
if [ -z "$COMMIT_VERSION" ]; then
301321
echo "No version found in commit message, skipping"
302322
exit 1
303323
fi
304324
305-
# Update Cargo.toml with the EXACT version from commit message (no auto-increment)
306-
sed -i "s/^version = \".*\"/version = \"$VERSION\"/" Cargo.toml
307-
echo "Updated Cargo.toml to EXACT version $VERSION (from commit message)"
325+
# Check that Cargo.toml version matches commit message
326+
CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | cut -d '"' -f 2)
327+
echo "Version in Cargo.toml: $CARGO_VERSION"
328+
329+
if [ "$CARGO_VERSION" != "$COMMIT_VERSION" ]; then
330+
echo "ERROR: Version mismatch!"
331+
echo " Commit message version: $COMMIT_VERSION"
332+
echo " Cargo.toml version: $CARGO_VERSION"
333+
echo "Please update Cargo.toml version to match commit message before releasing."
334+
exit 1
335+
fi
336+
337+
echo "✓ Version consistency validated: $COMMIT_VERSION"
308338
309339
- name: Install Rust
310340
uses: dtolnay/rust-toolchain@stable

.github/workflows/release.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,35 @@ jobs:
2121
steps:
2222
- uses: actions/checkout@v4
2323

24-
- name: Extract EXACT version from commit message
24+
- name: Validate version consistency and extract
2525
id: version
2626
run: |
2727
COMMIT_MSG="${{ github.event.head_commit.message }}"
28-
VERSION=$(echo "$COMMIT_MSG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
29-
echo "Using EXACT version from commit message: $VERSION"
30-
echo "No automatic version bumping - using developer-specified version"
28+
COMMIT_VERSION=$(echo "$COMMIT_MSG" | grep -oE '[0-9]+\.[0-9]+\.[0-9]+' | head -1)
29+
echo "Version in commit message: $COMMIT_VERSION"
3130
32-
if [ -z "$VERSION" ]; then
31+
if [ -z "$COMMIT_VERSION" ]; then
3332
echo "No version found in commit message"
3433
echo "To create a release, include version number in commit message (e.g., '1.2.3')"
3534
exit 1
3635
fi
3736
38-
echo "version=$VERSION" >> $GITHUB_OUTPUT
37+
# Check that Cargo.toml version matches commit message
38+
CARGO_VERSION=$(grep '^version = ' Cargo.toml | head -1 | cut -d '"' -f 2)
39+
echo "Version in Cargo.toml: $CARGO_VERSION"
40+
41+
if [ "$CARGO_VERSION" != "$COMMIT_VERSION" ]; then
42+
echo "ERROR: Version mismatch!"
43+
echo " Commit message version: $COMMIT_VERSION"
44+
echo " Cargo.toml version: $CARGO_VERSION"
45+
echo "Please update Cargo.toml version to match commit message before releasing."
46+
echo "Release process requires manual version update in Cargo.toml."
47+
exit 1
48+
fi
49+
50+
echo "✓ Version consistency validated: $COMMIT_VERSION"
51+
echo "Using developer-specified version (no automatic bumping)"
52+
echo "version=$COMMIT_VERSION" >> $GITHUB_OUTPUT
3953
4054
- name: Create Versioned GitHub Release
4155
id: release

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "digstore_min"
3-
version = "0.1.2"
3+
version = "0.4.0"
44
edition = "2021"
55
rust-version = "1.70"
66
authors = ["DIG Network"]

0 commit comments

Comments
 (0)