Add MSI installers for Windows and offer them through winget (#4948)
Co-authored-by: Marshall Porter <meoporter@gmail.com>
This commit is contained in:
1 parent
99bfd5aa0f
commit
96028e2a54
8 files changed
+188
-54
No files matched your search
@@ -18,6 +18,8 @@ jobs:
|
||||
release:
|
||||
runs-on: macos-latest
|
||||
environment: release
|
||||
outputs:
|
||||
version: ${{ steps.ver.outputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
with:
|
||||
@@ -74,3 +76,95 @@ jobs:
|
||||
MACOS_NOTARY_ISSUER_ID: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
|
||||
MACOS_NOTARY_KEY_ID: ${{ secrets.MACOS_NOTARY_KEY_ID }}
|
||||
MACOS_NOTARY_KEY: ${{ secrets.MACOS_NOTARY_KEY }}
|
||||
|
||||
# For the msi job
|
||||
- uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: windows-binaries
|
||||
path: |
|
||||
dist/*windows_amd64*/fzf.exe
|
||||
dist/*windows_arm64*/fzf.exe
|
||||
if-no-files-found: error
|
||||
|
||||
# winget's portable install runs fzf through a symlink that admin SSH
|
||||
# sessions refuse to follow (#4943). The MSI installs a real file instead.
|
||||
# WiX only runs on Windows.
|
||||
msi:
|
||||
needs: release
|
||||
runs-on: windows-latest
|
||||
env:
|
||||
# MSI versions cannot have a suffix such as -rc1
|
||||
BUILD_MSI: ${{ !contains(needs.release.outputs.version, '-') }}
|
||||
steps:
|
||||
- uses: actions/checkout@v7
|
||||
|
||||
- uses: actions/download-artifact@v8
|
||||
if: env.BUILD_MSI == 'true'
|
||||
with:
|
||||
name: windows-binaries
|
||||
path: dist
|
||||
|
||||
- uses: actions/setup-dotnet@v6
|
||||
if: env.BUILD_MSI == 'true'
|
||||
with:
|
||||
dotnet-version: '8.0.x'
|
||||
|
||||
# WiX 6 and later fall under the Open Source Maintenance Fee
|
||||
- name: Install WiX
|
||||
if: env.BUILD_MSI == 'true'
|
||||
run: dotnet tool install --global wix --version 5.0.2
|
||||
|
||||
- name: Build Windows MSI installers
|
||||
if: env.BUILD_MSI == 'true'
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
V='${{ needs.release.outputs.version }}'
|
||||
for pair in "amd64:x64" "arm64:arm64"; do
|
||||
goarch="${pair%%:*}"
|
||||
wixarch="${pair##*:}"
|
||||
bindir=$(dirname "$(find dist -type f -iname fzf.exe -path "*windows_${goarch}*" | head -n1)")
|
||||
wix build wix/main.wxs -arch "$wixarch" -d Version="$V" -d BinDir="$bindir" -o "dist/fzf-${V}-windows_${goarch}.msi"
|
||||
done
|
||||
ls -la dist/*.msi
|
||||
|
||||
- uses: actions/upload-artifact@v7
|
||||
if: env.BUILD_MSI == 'true'
|
||||
with:
|
||||
name: windows-msi
|
||||
path: dist/*.msi
|
||||
|
||||
- name: Upload MSI installers and publish release
|
||||
if: github.event_name == 'push'
|
||||
shell: bash
|
||||
run: |
|
||||
set -e
|
||||
V='${{ needs.release.outputs.version }}'
|
||||
# A re-run would replace MSIs that a winget manifest may already
|
||||
# reference, and submit to winget again
|
||||
if [[ $(gh release view "v$V" --json isDraft --jq .isDraft) != true ]]; then
|
||||
echo "::error::v$V is already published"
|
||||
exit 1
|
||||
fi
|
||||
if [[ $BUILD_MSI == true ]]; then
|
||||
sums="fzf_${V}_checksums.txt"
|
||||
# Drop MSI lines from a previous run of this job
|
||||
gh release download "v$V" -p "$sums" -O - | grep -v '\.msi$' > "dist/$sums"
|
||||
# sha256sum on Windows may print '<hash> *<name>'
|
||||
(cd dist && sha256sum fzf-*.msi) | sed 's/ \*/ /' >> "dist/$sums"
|
||||
gh release upload "v$V" dist/*.msi "dist/$sums" --clobber
|
||||
fi
|
||||
gh release edit "v$V" --draft=false
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
# Called directly because a release published with GITHUB_TOKEN does not
|
||||
# trigger other workflows
|
||||
winget:
|
||||
needs: [release, msi]
|
||||
if: github.event_name == 'push' && !contains(needs.release.outputs.version, '-')
|
||||
uses: ./.github/workflows/winget.yml
|
||||
with:
|
||||
release-tag: v${{ needs.release.outputs.version }}
|
||||
secrets:
|
||||
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
|
||||
@@ -1,7 +1,13 @@
|
||||
name: Publish to Winget
|
||||
on:
|
||||
release:
|
||||
types: [released]
|
||||
workflow_call:
|
||||
inputs:
|
||||
release-tag:
|
||||
type: string
|
||||
required: true
|
||||
secrets:
|
||||
WINGET_TOKEN:
|
||||
required: true
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release-tag:
|
||||
@@ -9,6 +15,11 @@ on:
|
||||
required: true
|
||||
type: string
|
||||
|
||||
# winget-releaser passes this token to unpinned actions. Submission uses
|
||||
# WINGET_TOKEN.
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
@@ -16,6 +27,6 @@ jobs:
|
||||
- uses: vedantmgoyal2009/winget-releaser@4ffc7888bffd451b357355dc214d43bb9f23917e # v2
|
||||
with:
|
||||
identifier: junegunn.fzf
|
||||
release-tag: ${{ inputs.release-tag || github.event.release.tag_name }}
|
||||
installers-regex: '-windows_(armv7|arm64|amd64)\.zip$'
|
||||
release-tag: ${{ inputs.release-tag }}
|
||||
installers-regex: '-windows_(arm64|amd64)\.(zip|msi)$'
|
||||
token: ${{ secrets.WINGET_TOKEN }}
|
||||
Reference in new issue
Block a user