Skip to content

Commit

Permalink
feat: update scoop experience
Browse files Browse the repository at this point in the history
resolves #150
  • Loading branch information
JanDeDobbeleer committed Nov 20, 2020
1 parent 77cd537 commit 4bcd98c
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 58 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/release.yml
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
36 changes: 20 additions & 16 deletions packages/scoop/build.ps1
Expand Up @@ -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
56 changes: 34 additions & 22 deletions packages/scoop/oh-my-posh.json
@@ -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"
}
}
}
}
}
14 changes: 0 additions & 14 deletions packages/scoop/post-install.ps1

This file was deleted.

0 comments on commit 4bcd98c

Please sign in to comment.