Skip to content

Commit 8973a6c

Browse files
committed
Reapply "Release 0.1-beta.1+2.1.3"
This reverts commit 321027f.
1 parent 695664d commit 8973a6c

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
@@ -53,12 +53,24 @@ jobs:
5353
id: validate
5454
shell: pwsh
5555
run: |
56+
# Récupère le nom du tag en supprimant le préfixe "v"
5657
$tagName = "${{ github.ref_name }}"
58+
Import-Module -Name PSSemVer -ErrorAction Stop
5759
try {
5860
$rawVersion = $tagName -replace '^v', ''
5961
$Version = [PSSemVer]::Parse($rawVersion)
60-
echo "prerelease=$($Version.Prerelease -ne $null)" >> $env:GITHUB_ENV
61-
echo "nuget_version=$($Version.metadata)" >> $env:GITHUB_ENV
62+
63+
# Forcer le booléen à une chaîne en minuscules
64+
$prereleaseValue = ($Version.Prerelease -ne $null).ToString().ToLower()
65+
echo "prerelease=$prereleaseValue" >> $env:GITHUB_ENV
66+
67+
# Vérifier que le champ metadata est renseigné pour la version NuGet
68+
if (-not [string]::IsNullOrEmpty($Version.metadata)) {
69+
echo "nuget_version=$($Version.metadata)" >> $env:GITHUB_ENV
70+
} else {
71+
Write-Error "Metadata is empty. Cannot determine NuGet version."
72+
exit 1
73+
}
6274
} catch {
6375
Write-Error "Tag name does not contain a valid semantic version. Current tag: $tagName"
6476
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
@@ -30,22 +30,24 @@ jobs:
3030
$branchName = "${{ github.event.pull_request.head.ref }}"
3131
$version = $branchName -replace '^release/', ''
3232
Write-Host "Extracted version: $version"
33-
echo "version=$version" >> $GITHUB_ENV
33+
echo "version=$version" >> $env:GITHUB_ENV
3434
3535
- name: Create Git Tag
3636
id: create_tag
37+
shell: pwsh
3738
run: |
3839
git config user.name "GitHub Actions"
3940
git config user.email "actions@github.com"
40-
git tag "v${{ env.version }}" -a -m "Release version ${{ env.version }}"
41+
git tag "v${{ env.version }}" -a -m "Release version $env:version"
4142
git push origin "v${{ env.version }}"
4243
env:
4344
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4445

4546
- name: Verify Tag
47+
shell: pwsh
4648
run: |
4749
git fetch --tags
48-
if (! git tag | grep -q "v${{ env.version }}") {
49-
echo "Tag creation failed for version ${{ env.version }}."
50+
if (-not (git tag | Select-String "v${{ env.version }}")) {
51+
Write-Host "Tag creation failed for version $env:version."
5052
exit 1
5153
}

0 commit comments

Comments
 (0)