feat(install): upload to CDN

This commit is contained in:
Jan De Dobbeleer 2024-11-27 11:29:42 +01:00
parent dfcccaabe0
commit f6880a2b79
2 changed files with 18 additions and 3 deletions

View file

@ -26,7 +26,7 @@ jobs:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
run: |
$version = $env:GITHUB_REF.TrimStart("refs/tags/v")
./build.ps1 -Architecture ${{ matrix.arch }} -Version $version -Download -Sign
./build.ps1 -Architecture ${{ matrix.arch }} -Version $version -Download -Sign -Upload
- name: Upload artifacts 🆙
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:

View file

@ -10,7 +10,8 @@ Param
[string]
$SDKVersion = "10.0.22621.0",
[switch]$Download,
[switch]$Sign
[switch]$Sign,
[switch]$Upload
)
$PSDefaultParameterValues['Out-File:Encoding'] = 'UTF8'
@ -35,7 +36,8 @@ if ($Download) {
$env:VERSION = $Version
# create MSI
$installer = "./out/install-$Architecture.msi"
$fileName = "install-$Architecture.msi"
$installer = "./out/$fileName"
wix build -arch $Architecture -out $installer .\oh-my-posh.wxs
if ($Sign) {
@ -55,3 +57,16 @@ if ($Sign) {
# get hash
$zipHash = Get-FileHash $installer -Algorithm SHA256
$zipHash.Hash | Out-File -Encoding 'UTF8' "$installer.sha256"
if (-not $Upload) {
exit
}
az storage blob upload --container-name "v$Version" --file $installer --name $fileName --connection-string $env.CDN_CONNECTIONSTRING
az storage blob upload --container-name 'latest' --file $installer --name $fileName --overwrite true --connection-string $env.CDN_CONNECTIONSTRING
# create version file
$versionFile = "version.txt"
New-Item -Path $versionFile -ItemType File -Value "v$Version"
az storage blob upload --container-name 'latest' --file $versionFile --name $versionFile --overwrite true --connection-string $env.CDN_CONNECTIONSTRING