Skip to content

Commit

Permalink
Feat: Choco package will now download and install .MSI file from GitHub.
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardog committed Nov 23, 2022
1 parent 22cb93e commit 5a8ad5f
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 19 deletions.
11 changes: 3 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,20 +46,15 @@ jobs:
[IO.File]::WriteAllBytes("$env:cert_path", $pfx_cert_byte)
- name: Code Sign
run: ./build/03-sign.ps1
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Binaries
path: ./artifacts
- name: Package for GitHub Release
run: ./build/04-release-GitHub.ps1
- name: Remove the pfx
run: Remove-Item -path $env:cert_path
- name: Upload installer artifacts
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Installer
path: ./artifacts/gsudoSetup.msi
name: Binaries
path: ./artifacts
- name: Create Release
uses: ncipollo/[email protected]
with:
Expand Down
8 changes: 2 additions & 6 deletions build/05-release-Chocolatey.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,14 @@ if ($env:version) {
"- Cleaning Choco template folder"
git clean .\Build\Chocolatey\gsudo -xf

"- Adding Artifacts"
cp artifacts\x?? .\Build\Chocolatey\gsudo\tools -Recurse -Force -Exclude *.pdb
cp artifacts\arm64 .\Build\Chocolatey\gsudo\tools -Recurse -Force -Exclude *.pdb

Get-ChildItem .\build\Chocolatey\gsudo\tools\ -Recurse -Filter *.exe | % { ni "$($_.FullName).ignore" } > $null

# Generate gsudo.nuspec
(Get-Content Build\Chocolatey\gsudo.nuspec.template) -replace '#VERSION#', "$version" | Out-File -encoding UTF8 .\Build\Chocolatey\gsudo\gsudo.nuspec

# Generate chocolateyinstall.ps1
(Get-Content .\build\Chocolatey\gsudo\tools\chocolateyinstall.ps1.template)
-replace '#VERSION#', "$version"
(Get-Content .\build\Chocolatey\chocolateyinstall.ps1.template) `
-replace '#VERSION#', "$version" `
-replace '#SHA#', (Get-FileHash .\artifacts\gsudoSetup.msi).Hash |
Out-File -encoding UTF8 .\build\Chocolatey\gsudo\tools\chocolateyinstall.ps1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ $packageArgs = @{
checksum64 = '#SHA#'
checksumType64= 'sha256'

silentArgs = "" # ALLUSERS=1 DISABLEDESKTOPSHORTCUT=1 ADDDESKTOPICON=0 ADDSTARTMENU=0
silentArgs = "/qn /norestart" # ALLUSERS=1 DISABLEDESKTOPSHORTCUT=1 ADDDESKTOPICON=0 ADDSTARTMENU=0
validExitCodes= @(0, 3010, 1641)
}

Expand All @@ -101,15 +101,17 @@ Install-ChocolateyPackage @packageArgs
Update-SessionEnvironment

if (Get-Module gsudoModule) {
if ((get-Module gsudoModule).Path)
" Import-Module `'$((Get-Command gsudoModule.psd1).Source)`'"
if ((Split-Path (Get-Module gsudoModule).Path -Parent) -ne (Split-Path (Get-Command gsudoModule.psd1). Source -Parent)) {
"IMPORTANT! Please update your `$PROFILE: Use the following gsudoModule path."
" Import-Module `'$((Get-Command gsudoModule.psd1).Source)`'"
}
} else {
& {
"PowerShell users: To use enhanced gsudo and Invoke-Gsudo cmdlet, add the following line to your `$PROFILE"
" Import-Module `'$((Get-Command gsudoModule.psd1).Source)`'"
"Or run: "
" Get-Command gsudoModule.psd1 | % { Write-Output `"``nImport-Module ```"`$(`$_.Source)```"`" | Add-Content `$PROFILE }"
}
Write-Output "`ngsudo successfully installed. Please restart your consoles to use gsudo.`n"

Write-Output "`nPlease restart your consoles to use gsudo.`n"
}
File renamed without changes.
Empty file.

0 comments on commit 5a8ad5f

Please sign in to comment.