diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index df23c3d87a62..6da467eb5ac2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -173,7 +173,7 @@ jobs: - name: Pack and push run: ./deploy.ps1 -BinVersion ${{ needs.release.outputs.version }} -ModuleVersion ${{ needs.release.outputs.version }} -Repository PSGallery -RepositoryAPIKey $env:PSGALLERY_KEY scoop: - needs: [release, artifacts, themes] + needs: [release, artifacts] if: ${{ needs.release.outputs.skipped == 'false' }} runs-on: ubuntu-latest defaults: @@ -184,7 +184,7 @@ jobs: - name: Checkout code uses: actions/checkout@v2 - name: Update Template - run: ./build.ps1 -Version ${{ needs.release.outputs.version }} -LinuxSHA ${{ needs.artifacts.outputs.hash_linux }} -WindowsSHA ${{ needs.artifacts.outputs.hash_windows }} -ThemesSHA ${{ needs.themes.outputs.hash_themes }} + run: ./build.ps1 -Version ${{ needs.release.outputs.version }} - name: Upload Scoop JSON id: upload-scoop-json uses: actions/upload-release-asset@v1 @@ -195,13 +195,13 @@ jobs: asset_path: ${{ github.workspace }}/packages/scoop/oh-my-posh.json asset_name: oh-my-posh.json asset_content_type: text/plain - - name: Upload Scoop Post Install + - name: Upload Scoop Archive id: upload-scoop-post-install uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.release.outputs.upload_url }} - asset_path: ${{ github.workspace }}/packages/scoop/post-install.ps1 - asset_name: post-install.ps1 - asset_content_type: text/plain + asset_path: ${{ github.workspace }}/packages/scoop/posh-windows-wsl-amd64.7z + asset_name: posh-windows-wsl-amd64.7z + asset_content_type: application/octet-stream diff --git a/packages/scoop/build.ps1 b/packages/scoop/build.ps1 index 645567c7efc3..dbbc03005252 100644 --- a/packages/scoop/build.ps1 +++ b/packages/scoop/build.ps1 @@ -2,23 +2,27 @@ Param ( [parameter(Mandatory = $true)] [string] - $Version, - [parameter(Mandatory = $true)] - [string] - $LinuxSHA, - [parameter(Mandatory = $true)] - [string] - $WindowsSHA, - [parameter(Mandatory = $true)] - [string] - $ThemesSHA + $Version ) +New-Item -Path "." -Name "bin" -ItemType Directory +Copy-Item -Path "../../themes" -Destination "./bin" -Recurse + +# Download the files and pack them +@{name = 'posh-windows-amd64.exe'; outName = 'oh-my-posh.exe' }, @{name = 'posh-linux-amd64'; outName = 'oh-my-posh-wsl' } | ForEach-Object -Process { + $download = "https://github.com/jandedobbeleer/oh-my-posh3/releases/download/v$Version/$($_.name)" + Invoke-WebRequest $download -Out "./bin/$($_.outName)" +} +$compress = @{ + Path = "./bin/*" + CompressionLevel = "Fastest" + DestinationPath = "./posh-windows-wsl-amd64.7z" +} +Compress-Archive @compress +$zipHash = Get-FileHash ./posh-windows-wsl-amd64.7z -Algorithm SHA256 $content = Get-Content '.\oh-my-posh.json' -Raw $content = $content.Replace('', $Version) -$content = $content.Replace('', $LinuxSHA) -$content = $content.Replace('', $WindowsSHA) -$fileHash = Get-FileHash post-install.ps1 -Algorithm SHA256 -$content = $content.Replace('', $fileHash.Hash) -$content = $content.Replace('', $ThemesSHA) -$content | Out-File -Encoding 'UTF8' '.\oh-my-posh.json' +$content = $content.Replace('', $zipHash.Hash) +$content | Out-File -Encoding 'UTF8' './oh-my-posh.json' + +Remove-Item ./bin/ -Recurse diff --git a/packages/scoop/oh-my-posh.json b/packages/scoop/oh-my-posh.json index df01197f4063..5c9449f32159 100644 --- a/packages/scoop/oh-my-posh.json +++ b/packages/scoop/oh-my-posh.json @@ -1,24 +1,36 @@ { - "version": "", - "description": "A prompt theme engine for any shell", - "homepage": "https://ohmyposh.dev", - "license": { - "identifier": "GPL-3.0-only", - "url": "https://github.com/JanDeDobbeleer/oh-my-posh3/blob/main/COPYING" - }, - "url": [ - "https://github.com/JanDeDobbeleer/oh-my-posh3/releases/download/v/posh-linux-amd64", - "https://github.com/JanDeDobbeleer/oh-my-posh3/releases/download/v/posh-windows-amd64.exe", - "https://github.com/JanDeDobbeleer/oh-my-posh3/releases/download/v/post-install.ps1", - "https://github.com/JanDeDobbeleer/oh-my-posh3/releases/download/v/themes.zip" - ], - "hash": [ - "", - "", - "", - "" - ], - "extract_to": "themes", - "post_install": "& \"$dir/post-install.ps1\"", - "bin": ["posh-linux-amd64", "posh-windows-amd64.exe"] + "version": "", + "description": "A prompt theme engine for any shell", + "homepage": "https://ohmyposh.dev", + "license": { + "identifier": "GPL-3.0-only", + "url": "https://github.com/JanDeDobbeleer/oh-my-posh3/blob/main/COPYING" + }, + "architecture": { + "64bit": { + "url": "https://github.com/JanDeDobbeleer/oh-my-posh3/releases/download/v/posh-windows-wsl-amd64.7z", + "hash": "" + } + }, + "bin": [ + "oh-my-posh-wsl", + "oh-my-posh.exe" + ], + "checkver": { + "github": "https://github.com/JanDeDobbeleer/oh-my-posh3" + }, + "post_install": [ + "Write-Host 'Thanks for installing Oh my Posh.'", + "Write-Host 'Have a look at https://ohmyposh.dev/docs/installation for detailed instructions for your shell.'" + ], + "autoupdate": { + "architecture": { + "64bit": { + "url": "https://github.com/JanDeDobbeleer/oh-my-posh3/releases/download/v$version/posh-windows-wsl-amd64.7z", + "hash": { + "url": "$url.sha256" + } + } + } + } } diff --git a/packages/scoop/post-install.ps1 b/packages/scoop/post-install.ps1 deleted file mode 100644 index c236fb9cbadd..000000000000 --- a/packages/scoop/post-install.ps1 +++ /dev/null @@ -1,14 +0,0 @@ -$logo = @' - __ _____ _ ___ ___ ______ _ __ - / / | _ | | | \/ | | ___ \ | | \ \ - / / | | | | |__ | . . |_ _ | |_/ /__ ___| |__ \ \ -< < | | | | '_ \ | |\/| | | | | | __/ _ \/ __| '_ \ > > - \ \ \ \_/ / | | | | | | | |_| | | | | (_) \__ \ | | | / / - \_\ \___/|_| |_| \_| |_/\__, | \_| \___/|___/_| |_| /_/ - __/ | - |___/ -'@ -Write-Host $logo -Write-Host '' -Write-Host 'Thanks for installing Oh my Posh.' -Write-Host 'Have a look at https://ohmyposh.dev/docs/installation for detailed instructions for your shell.'