Skip to content

Commit dd58e4f

Browse files
committed
ci: Use .NET 8
AzureSignTool requires .NET 8. Install .NET 8 in CI and update the F# program to target .NET 8. As part of this, move off of the deprecated `HashAlgorithm.Create` and cleanup the SHA256 code. `wingetcreate.exe` still requires .NET 6. So we install both .NET 8 and .NET 6 using `setup-dotnet`.
1 parent d1b658c commit dd58e4f

File tree

4 files changed

+17
-20
lines changed

4 files changed

+17
-20
lines changed

.github/workflows/deploy.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ jobs:
1313
runs-on: windows-latest
1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v2
17-
- name: Setup dotnet SDK v6.0
18-
uses: actions/setup-dotnet@v1
16+
uses: actions/checkout@v4
17+
- name: Setup dotnet
18+
uses: actions/setup-dotnet@v4
1919
with:
20-
dotnet-version: '6.0.x'
20+
dotnet-version: |
21+
6.0.x
22+
8.0.x
2123
- name: Set path for candle and light from WixTools
2224
run: echo "C:\Program Files (x86)\WiX Toolset v3.14\bin" >> $GITHUB_PATH
2325
shell: bash
@@ -26,10 +28,6 @@ jobs:
2628
dotnet tool install --global AzureSignTool
2729
- name: Generate Pulumi MSI
2830
run: dotnet run --project ./src -- generate msi "${{ secrets.AZURE_KEY_VAULT_URI }}" "${{ secrets.AZURE_CLIENT_ID }}" "${{ secrets.AZURE_TENANT_ID }}" "${{ secrets.AZURE_CLIENT_SECRET }}" "${{ secrets.AZURE_CERT_NAME }}"
29-
- name: Setup dotnet SDK v5.0
30-
uses: actions/setup-dotnet@v1
31-
with:
32-
dotnet-version: '5.0.x'
3331
- name: Push WinGet Manifest
3432
shell: powershell
3533
run: |

.github/workflows/generate-msi.yml

+6-8
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,13 @@ jobs:
1313
runs-on: windows-latest
1414
steps:
1515
- name: Checkout code
16-
uses: actions/checkout@v2
17-
- name: Setup dotnet SDK v6.0
18-
uses: actions/setup-dotnet@v1
16+
uses: actions/checkout@v4
17+
- name: Setup dotnet
18+
uses: actions/setup-dotnet@v4
1919
with:
20-
dotnet-version: '6.0.x'
20+
dotnet-version: |
21+
6.0.x
22+
8.0.x
2123
- name: Set path for candle and light from WixTools
2224
run: echo "C:\Program Files (x86)\WiX Toolset v3.14\bin" >> $GITHUB_PATH
2325
shell: bash
@@ -26,10 +28,6 @@ jobs:
2628
dotnet tool install --global AzureSignTool
2729
- name: Generate Pulumi MSI
2830
run: dotnet run --project ./src -- generate msi "${{ secrets.AZURE_KEY_VAULT_URI }}" "${{ secrets.AZURE_CLIENT_ID }}" "${{ secrets.AZURE_TENANT_ID }}" "${{ secrets.AZURE_CLIENT_SECRET }}" "${{ secrets.AZURE_CERT_NAME }}"
29-
- name: Setup dotnet SDK v5.0
30-
uses: actions/setup-dotnet@v1
31-
with:
32-
dotnet-version: '5.0.x'
3331
- name: Push WinGet Manifest
3432
shell: powershell
3533
run: |

src/Program.fs

+4-3
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,10 @@ let clean() =
106106
File.Delete filePath
107107

108108
let computeSha256 (file: string) =
109-
let sha256Algo = HashAlgorithm.Create("SHA256")
110-
let sha256 = sha256Algo.ComputeHash(new MemoryStream(File.ReadAllBytes file))
111-
BitConverter.ToString(sha256).Replace("-", "")
109+
use fs = File.OpenRead(file)
110+
use sha256 = SHA256.Create()
111+
let hashBytes = sha256.ComputeHash(fs)
112+
Convert.ToHexString(hashBytes)
112113

113114
let generateMsi (keyVaultUri: string) (clientId: string) (tenantId: string) (clientSecret: string) (certName: string) =
114115
let latestRelease = await (github.Repository.Release.GetLatest("pulumi", "pulumi"))

src/PulumiWingetManifest.fsproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net6.0</TargetFramework>
5+
<TargetFramework>net8.0</TargetFramework>
66
</PropertyGroup>
77

88
<ItemGroup>

0 commit comments

Comments
 (0)