diff --git a/.github/scripts/update-scoop-manifest.ps1 b/.github/scripts/update-scoop-manifest.ps1 new file mode 100644 index 0000000..9ed6617 --- /dev/null +++ b/.github/scripts/update-scoop-manifest.ps1 @@ -0,0 +1,36 @@ +# Points bucket/compactor.json at the latest GitHub release. +# Requires the GitHub CLI (gh) with GH_TOKEN set when run in Actions. +param( + [string]$Manifest = (Join-Path $PSScriptRoot '..\..\bucket\compactor.json') +) + +$ErrorActionPreference = 'Stop' +$ProgressPreference = 'SilentlyContinue' + +$text = [IO.File]::ReadAllText($Manifest) +$json = $text | ConvertFrom-Json +$repository = $json.homepage -replace '^https://github\.com/', '' + +$tag = gh release view --repo $repository --json tagName --jq .tagName +if ($LASTEXITCODE -ne 0 -or -not $tag) { + throw "Could not read the latest release of $repository." +} + +$version = $tag -replace '^v', '' +if ($json.version -eq $version) { + Write-Host "Scoop manifest is already at $version." + return +} + +$url = $json.autoupdate.architecture.'64bit'.url -replace '\$version', $version +$download = Join-Path ([IO.Path]::GetTempPath()) "Compactor-$version.exe" +Invoke-WebRequest -Uri $url -OutFile $download -UseBasicParsing +$hash = (Get-FileHash -Path $download -Algorithm SHA256).Hash.ToLowerInvariant() +Remove-Item $download + +$text = $text -replace '("version":\s*")[^"]+"', "`${1}$version`"" +$text = $text -replace '("url":\s*")[^"$]+"', "`${1}$url`"" +$text = $text -replace '("hash":\s*")[^"]+"', "`${1}$hash`"" +[IO.File]::WriteAllText($Manifest, $text, (New-Object Text.UTF8Encoding $false)) + +Write-Host "Updated Scoop manifest from $($json.version) to $version." diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 40f22c3..5516299 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: workflow_dispatch: permissions: + actions: write contents: write pull-requests: read @@ -141,3 +142,8 @@ jobs: --title "Compactor $env:TAG" ` --notes-file release-notes.md ` --verify-tag + + - name: Update Scoop manifest + env: + GH_TOKEN: ${{ github.token }} + run: gh workflow run scoop.yml --repo ${{ github.repository }} --ref master diff --git a/.github/workflows/scoop.yml b/.github/workflows/scoop.yml new file mode 100644 index 0000000..aa11f85 --- /dev/null +++ b/.github/workflows/scoop.yml @@ -0,0 +1,35 @@ +name: Update Scoop manifest + +on: + schedule: + - cron: '30 6 * * *' + workflow_dispatch: + +permissions: + contents: write + +jobs: + update: + runs-on: ubuntu-latest + timeout-minutes: 10 + + steps: + - uses: actions/checkout@v7 + + - name: Update manifest + shell: pwsh + env: + GH_TOKEN: ${{ github.token }} + run: ./.github/scripts/update-scoop-manifest.ps1 + + - name: Commit manifest + run: | + if git diff --quiet -- bucket/compactor.json; then + exit 0 + fi + version=$(jq -r .version bucket/compactor.json) + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add bucket/compactor.json + git commit -m "Update Scoop manifest to $version" + git push diff --git a/CHANGELOG.md b/CHANGELOG.md index 49952c6..d3713ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Added + +- Scoop manifest in `bucket/`, so the repository can be added as a Scoop bucket. A scheduled workflow keeps it pointed at the latest release. + ## [0.11.5] - 2026-09-14 ### Added diff --git a/README.md b/README.md index 8a825ec..4c47bc5 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,15 @@ Download the latest Windows x64 executable from the [Releases](https://github.co Compactor is portable and does not require an installer or background service. +It can also be installed with [Scoop](https://scoop.sh) from the manifest in this repository: + +```powershell +scoop bucket add compactor https://github.com/wefalltomorrow/Compactor +scoop install compactor/compactor +``` + +Use `scoop update compactor` to upgrade. The `compactor/` prefix matters because the Scoop Extras bucket still carries the original 0.10.1 release under the same name. + ## Usage 1. Choose a folder. diff --git a/bucket/compactor.json b/bucket/compactor.json new file mode 100644 index 0000000..6185ba7 --- /dev/null +++ b/bucket/compactor.json @@ -0,0 +1,26 @@ +{ + "version": "0.11.5", + "description": "A lightweight GUI for Windows WOF filesystem compression", + "homepage": "https://github.com/wefalltomorrow/Compactor", + "license": "MIT", + "architecture": { + "64bit": { + "url": "https://github.com/wefalltomorrow/Compactor/releases/download/v0.11.5/Compactor.exe", + "hash": "92ecfed2b4b89fd65a92fd86839b31d009331f92885b43f76109b46ab7efcd20" + } + }, + "shortcuts": [ + [ + "Compactor.exe", + "Compactor" + ] + ], + "checkver": "github", + "autoupdate": { + "architecture": { + "64bit": { + "url": "https://github.com/wefalltomorrow/Compactor/releases/download/v$version/Compactor.exe" + } + } + } +}