Skip to content

Commit

Permalink
feat(install): use cdn for installer
Browse files Browse the repository at this point in the history
  • Loading branch information
JanDeDobbeleer committed Nov 25, 2024
1 parent ee5084d commit 934eae2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 40 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/microsoft_store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ jobs:
product-update: '{
"packages":[
{
"packageUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v${{ github.event.inputs.version }}/install-x64.msi",
"packageUrl":"https://cdn.ohmyposh.dev/releases/v${{ github.event.inputs.version }}/install-x64.msi",
"languages":["en"],
"architectures":["X64"],
"installerParameters":"/quiet INSTALLER=ws",
"isSilentInstall":false
},
{
"packageUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v${{ github.event.inputs.version }}/install-arm64.msi",
"packageUrl":"https://cdn.ohmyposh.dev/releases/v${{ github.event.inputs.version }}/install-arm64.msi",
"languages":["en"],
"architectures":["Arm64"],
"installerParameters":"/quiet INSTALLER=ws",
"isSilentInstall":false
},
{
"packageUrl":"https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v${{ github.event.inputs.version }}/install-x86.msi",
"packageUrl":"https://cdn.ohmyposh.dev/releases/v${{ github.event.inputs.version }}/install-x86.msi",
"languages":["en"],
"architectures":["X86"],
"installerParameters":"/quiet INSTALLER=ws",
Expand Down
29 changes: 2 additions & 27 deletions .github/workflows/msi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,35 +24,10 @@ jobs:
AZURE_CLIENT_SECRET: ${{ secrets.AZURE_CLIENT_SECRET }}
AZURE_CLIENT_ID: ${{ secrets.AZURE_CLIENT_ID }}
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID }}
CDN_CONNECTIONSTRING: ${{ secrets.CDN_CONNECTIONSTRING }}
run: |
$version = $env:GITHUB_REF.TrimStart("refs/tags/v")
./build.ps1 -Architecture ${{ matrix.arch }} -Version $version -Download -Sign
- name: Upload artifacts 🆙
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
console.log('environment', process.versions);
const fs = require('fs').promises;
const { repo: { owner, repo }, sha } = context;
console.log({ owner, repo, sha });
for (let file of await fs.readdir('./packages/msi/out')) {
if (file.indexOf(".msi") < 0) {
continue;
}
console.log('uploading', file);
await github.rest.repos.uploadReleaseAsset({
owner, repo,
release_id: ${{ github.event.release.id }},
name: file,
data: await fs.readFile(`./packages/msi/out/${file}`)
});
}
./build.ps1 -Architecture ${{ matrix.arch }} -Version $version -Download -Sign -Upload
notify:
runs-on: ubuntu-latest
needs: package
Expand Down
12 changes: 10 additions & 2 deletions packages/msi/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ Param
[string]
$SDKVersion = "10.0.22621.0",
[switch]$Download,
[switch]$Sign
[switch]$Sign,
[switch]$Upload
)

$PSDefaultParameterValues['Out-File:Encoding'] = 'UTF8'
Expand All @@ -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) {
Expand All @@ -55,3 +57,9 @@ 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
4 changes: 2 additions & 2 deletions packages/scoop/oh-my-posh.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
},
"architecture": {
"64bit": {
"url": "https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x64.msi",
"url": "https://cdn.ohmyposh.dev/releases/v<VERSION>/install-x64.msi",
"hash": "<HASH-AMD64>"
},
"32bit": {
"url": "https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x86.msi",
"url": "https://cdn.ohmyposh.dev/releases/v<VERSION>/install-x86.msi",
"hash": "<HASH-386>"
}
},
Expand Down
12 changes: 6 additions & 6 deletions packages/winget/JanDeDobbeleer.OhMyPosh.installer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,42 @@ InstallModes:
- silentWithProgress
Installers:
- Architecture: x64
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x64.msi
InstallerUrl: https://cdn.ohmyposh.dev/releases/v<VERSION>/install-x64.msi
InstallerSha256: <HASH-AMD64>
Scope: machine
UpgradeBehavior: install
InstallerSwitches:
Custom: INSTALLER=winget ALLUSERS=1
- Architecture: x64
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x64.msi
InstallerUrl: https://cdn.ohmyposh.dev/releases/v<VERSION>/install-x64.msi
InstallerSha256: <HASH-AMD64>
Scope: user
UpgradeBehavior: install
InstallerSwitches:
Custom: INSTALLER=winget
- Architecture: x86
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x86.msi
InstallerUrl: https://cdn.ohmyposh.dev/releases/v<VERSION>/install-x86.msi
InstallerSha256: <HASH-386>
Scope: machine
UpgradeBehavior: install
InstallerSwitches:
Custom: INSTALLER=winget ALLUSERS=1
- Architecture: x86
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-x86.msi
InstallerUrl: https://cdn.ohmyposh.dev/releases/v<VERSION>/install-x86.msi
InstallerSha256: <HASH-386>
Scope: user
UpgradeBehavior: install
InstallerSwitches:
Custom: INSTALLER=winget
- Architecture: arm64
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-arm64.msi
InstallerUrl: https://cdn.ohmyposh.dev/releases/v<VERSION>/install-arm64.msi
InstallerSha256: <HASH-ARM64>
Scope: machine
UpgradeBehavior: install
InstallerSwitches:
Custom: INSTALLER=winget ALLUSERS=1
- Architecture: arm64
InstallerUrl: https://github.com/JanDeDobbeleer/oh-my-posh/releases/download/v<VERSION>/install-arm64.msi
InstallerUrl: https://cdn.ohmyposh.dev/releases/v<VERSION>/install-arm64.msi
InstallerSha256: <HASH-ARM64>
Scope: user
UpgradeBehavior: install
Expand Down

0 comments on commit 934eae2

Please sign in to comment.