Deploy Chocolatey #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Chocolatey | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: 'Git Tag' | |
required: true | |
permissions: | |
contents: read | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
chocolatey: | |
name: Deploy to chocolatey.org | |
runs-on: windows-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v4 | |
- name: Set Checksum | |
run: | | |
filename="OpenHV-${{ github.event.inputs.tag }}-x86.exe" | |
url="https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.tag }}/${filename}" | |
sed -i "s#{URL32}#${url}#g" "tools/chocolateyinstall.ps1" | |
curl -sSL "${url}" -o "${filename}" | |
md5=$(cat "${filename}" | md5sum -) | |
sed -i "s/{MD5CHECKSUM32}/${md5:0:32}/g" "tools/chocolateyinstall.ps1" | |
filename="OpenHV-${{ github.event.inputs.tag }}-x64.exe" | |
url="https://github.com/${{ github.repository }}/releases/download/${{ github.event.inputs.tag }}/${filename}" | |
sed -i "s#{URL64}#${url}#g" "tools/chocolateyinstall.ps1" | |
curl -sSL "${url}" -o "${filename}" | |
md5=$(cat "${filename}" | md5sum -) | |
sed -i "s/{MD5CHECKSUM64}/${md5:0:32}/g" "tools/chocolateyinstall.ps1" | |
- name: Set Version | |
id: version | |
run: | | |
tag=${{ github.event.inputs.tag }} | |
version="${tag:0:4}.${tag:4:2}.${tag:6:2}" | |
echo "nuget=$version" >> $GITHUB_OUTPUT | |
sed -i "s/{VERSION}/${version}/g" "openhv.nuspec" | |
- name: Pack Release | |
run: | | |
choco pack openhv.nuspec --outputdirectory chocolatey | |
- name: Upload Release | |
run: | | |
package=$(find -type f -name "*.nupkg") | |
choco push $package -s https://push.chocolatey.org/ -k ${{ secrets.CHOCO_KEY }} --allow-unofficial |