feat: update scoop experience

resolves #150
This commit is contained in:
Jan De Dobbeleer 2020-11-20 09:56:52 +01:00 committed by Jan De Dobbeleer
parent 77cd537501
commit 4bcd98cda7
4 changed files with 60 additions and 58 deletions

View file

@ -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

View file

@ -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>', $Version)
$content = $content.Replace('<HASH_LINUX>', $LinuxSHA)
$content = $content.Replace('<HASH_WINDOWS>', $WindowsSHA)
$fileHash = Get-FileHash post-install.ps1 -Algorithm SHA256
$content = $content.Replace('<HASH_INSTALL_SCRIPT>', $fileHash.Hash)
$content = $content.Replace('<HASH_THEMES>', $ThemesSHA)
$content | Out-File -Encoding 'UTF8' '.\oh-my-posh.json'
$content = $content.Replace('<HASH>', $zipHash.Hash)
$content | Out-File -Encoding 'UTF8' './oh-my-posh.json'
Remove-Item ./bin/ -Recurse

View file

@ -1,24 +1,36 @@
{
"version": "<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<VERSION>/posh-linux-amd64",
"https://github.com/JanDeDobbeleer/oh-my-posh3/releases/download/v<VERSION>/posh-windows-amd64.exe",
"https://github.com/JanDeDobbeleer/oh-my-posh3/releases/download/v<VERSION>/post-install.ps1",
"https://github.com/JanDeDobbeleer/oh-my-posh3/releases/download/v<VERSION>/themes.zip"
],
"hash": [
"<HASH_LINUX>",
"<HASH_WINDOWS>",
"<HASH_INSTALL_SCRIPT>",
"<HASH_THEMES>"
],
"extract_to": "themes",
"post_install": "& \"$dir/post-install.ps1\"",
"bin": ["posh-linux-amd64", "posh-windows-amd64.exe"]
"version": "<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<VERSION>/posh-windows-wsl-amd64.7z",
"hash": "<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"
}
}
}
}
}

View file

@ -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.'