Skip to content

Commit fd4df8f

Browse files
committed
Release 0.1-beta.1+2.1.3
1 parent ca1bddb commit fd4df8f

File tree

6 files changed

+137
-66
lines changed

6 files changed

+137
-66
lines changed

.github/workflows/deploy.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,24 @@ jobs:
4949
id: validate
5050
shell: pwsh
5151
run: |
52+
# Récupère le nom du tag en supprimant le préfixe "v"
5253
$tagName = "${{ github.ref_name }}"
54+
Import-Module -Name PSSemVer -ErrorAction Stop
5355
try {
5456
$rawVersion = $tagName -replace '^v', ''
5557
$Version = [PSSemVer]::Parse($rawVersion)
56-
echo "prerelease=$($Version.Prerelease -ne $null)" >> $env:GITHUB_ENV
57-
echo "nuget_version=$($Version.metadata)" >> $env:GITHUB_ENV
58+
59+
# Forcer le booléen à une chaîne en minuscules
60+
$prereleaseValue = ($Version.Prerelease -ne $null).ToString().ToLower()
61+
echo "prerelease=$prereleaseValue" >> $env:GITHUB_ENV
62+
63+
# Vérifier que le champ metadata est renseigné pour la version NuGet
64+
if (-not [string]::IsNullOrEmpty($Version.metadata)) {
65+
echo "nuget_version=$($Version.metadata)" >> $env:GITHUB_ENV
66+
} else {
67+
Write-Error "Metadata is empty. Cannot determine NuGet version."
68+
exit 1
69+
}
5870
} catch {
5971
Write-Error "Tag name does not contain a valid semantic version. Current tag: $tagName"
6072
exit 1

.github/workflows/release-checks.yml

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -30,77 +30,68 @@ jobs:
3030
- name: Cache PowerShell Modules
3131
uses: actions/cache@v3
3232
with:
33-
path: |
34-
$env:USERPROFILE\Documents\WindowsPowerShell\Modules
33+
path: C:\Users\runneradmin\Documents\PowerShell\Modules
3534
key: ${{ runner.os }}-powershell-modules
3635
restore-keys: ${{ runner.os }}-powershell-modules-
3736

3837
- name: Install Rust
3938
shell: pwsh
40-
run: rustup update stable && rustup default stable
39+
run: |
40+
rustup update stable
41+
rustup default stable
4142
4243
- name: Install PSSemVer
4344
shell: pwsh
4445
run: |
45-
try {
46-
Import-Module -Name PSSemVer -ErrorAction Stop
47-
} catch {
48-
Write-Host "Installing PSSemVer module..."
46+
if (-not (Get-Module -ListAvailable -Name PSSemVer)) {
4947
Install-Module -Name PSSemVer -Scope CurrentUser -Force -ErrorAction Stop
50-
Import-Module -Name PSSemVer -ErrorAction Stop
5148
}
49+
Import-Module -Name PSSemVer -ErrorAction Stop
5250
5351
- name: Extract Branch Version
5452
id: extract_version
5553
shell: pwsh
5654
run: |
5755
$branchName = "${{ github.ref_name }}"
56+
$rawVersion = $branchName -replace '^release/', ''
57+
Import-Module -Name PSSemVer -ErrorAction Stop
5858
try {
59-
$rawVersion = $branchName -replace '^release/', ''
6059
$expectedVersion = [PSSemVer]::Parse($rawVersion)
61-
62-
Write-Output "expected_version=$expectedVersion" | Out-File -FilePath $GITHUB_OUTPUT -Encoding utf8
63-
Write-Host "Expected version for crates: $expectedVersion"
6460
} catch {
65-
Write-Error "Branch name does not contain a valid semantic version. Current branch: $branchName"
61+
Write-Error "❌ ERROR: Failed to parse '$rawVersion' as a valid SemVer version."
6662
exit 1
6763
}
64+
echo "EXPECTED_VERSION=$expectedVersion" >> $env:GITHUB_ENV
6865
6966
- name: Parse and Compare Crate Versions
7067
shell: pwsh
71-
env:
72-
EXPECTED_VERSION: ${{ steps.extract_version.outputs.expected_version }}
7368
run: |
69+
Import-Module -Name PSSemVer -ErrorAction Stop
7470
try {
7571
$expectedSemVer = [PSSemVer]::Parse($env:EXPECTED_VERSION)
7672
} catch {
77-
Write-Error "Expected version '$env:EXPECTED_VERSION' is not a valid semantic version."
73+
Write-Error "❌ ERROR: Expected version '$env:EXPECTED_VERSION' is not a valid semantic version."
7874
exit 1
7975
}
8076
81-
# Retrieve package version using cargo pkgid
8277
$pkgid = cargo pkgid --quiet
83-
if ($pkgid -match "#([\d\.]+)") {
78+
if ($pkgid -match "#(.+)$") {
8479
$currentVersion = $matches[1]
8580
} else {
86-
Write-Error "Failed to extract version from cargo pkgid output: $pkgid"
81+
Write-Error "❌ ERROR: Failed to extract version from cargo pkgid output: $pkgid"
8782
exit 1
8883
}
8984
90-
Write-Host "Current crate version: $currentVersion"
91-
9285
try {
9386
$currentSemVer = [PSSemVer]::Parse($currentVersion)
9487
} catch {
95-
Write-Error "Current version '$currentVersion' is not a valid semantic version."
88+
Write-Error "❌ ERROR: Current version '$currentVersion' is not a valid semantic version."
9689
exit 1
9790
}
9891
9992
if ($currentSemVer.CompareTo($expectedSemVer) -ne 0) {
100-
Write-Error "ERROR: Crate version '$currentSemVer' does not match expected '$expectedSemVer'."
93+
Write-Error "ERROR: Crate version '$currentSemVer' does not match expected '$expectedSemVer'."
10194
exit 1
102-
} else {
103-
Write-Host "Crate version '$currentSemVer' matches the branch version."
10495
}
10596
10697
publish-dry-run:
@@ -126,18 +117,18 @@ jobs:
126117

127118
- name: Install Rust
128119
shell: pwsh
129-
run: rustup update stable && rustup default stable
120+
run: |
121+
rustup update stable
122+
rustup default stable
130123
131124
- name: Run Tests
132125
shell: pwsh
133126
run: |
134-
echo "Running tests..."
135127
cargo test --all-targets
136128
137129
- name: Publish Dry-Run
138130
env:
139131
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
140132
shell: pwsh
141133
run: |
142-
echo "Running cargo publish dry-run..."
143134
cargo publish --dry-run

.github/workflows/release-tag.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,22 @@ jobs:
2525
$branchName = "${{ github.event.pull_request.head.ref }}"
2626
$version = $branchName -replace '^release/', ''
2727
Write-Host "Extracted version: $version"
28-
echo "version=$version" >> $GITHUB_ENV
28+
echo "version=$version" >> $env:GITHUB_ENV
2929
3030
- name: Create Git Tag
3131
id: create_tag
32+
shell: pwsh
3233
run: |
3334
git config user.name "GitHub Actions"
3435
git config user.email "actions@github.com"
35-
git tag "v${{ env.version }}" -a -m "Release version ${{ env.version }}"
36+
git tag "v${{ env.version }}" -a -m "Release version $env:version"
3637
git push origin "v${{ env.version }}"
3738
3839
- name: Verify Tag
40+
shell: pwsh
3941
run: |
4042
git fetch --tags
41-
if (! git tag | grep -q "v${{ env.version }}") {
42-
echo "Tag creation failed for version ${{ env.version }}."
43+
if (-not (git tag | Select-String "v${{ env.version }}")) {
44+
Write-Host "Tag creation failed for version $env:version."
4345
exit 1
4446
}

0 commit comments

Comments
 (0)