Publish Desktop Release to WinGet #38
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: Publish Desktop Release to WinGet | |
on: | |
workflow_dispatch: | |
release: | |
types: [released] | |
jobs: | |
publish: | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Detect Latest Release | |
id: latest_release | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const [owner, repo] = 'hrzlgnm/mdns-browser'.split('/'); | |
try { | |
const { data } = await github.rest.repos.getLatestRelease({ owner, repo }); | |
const tagName = data.tag_name; | |
return tagName; | |
} catch (error) { | |
core.setFailed(`Failed to get latest release for repo: ${owner}/${repo}`); | |
process.exit(1); | |
} | |
- name: Compose URL | |
shell: bash | |
run: | | |
VERSION=${{ steps.latest_release.outputs.result }} | |
SHORT_VERSION=${VERSION#*-v} | |
URL=https://github.com/hrzlgnm/mdns-browser/releases/download/{VERSION}/mdns-browser_{SHORT_VERSION}_x64-setup.exe | |
FINAL_URL=$(echo $URL | sed "s/{VERSION}/$VERSION/g" | sed "s/{SHORT_VERSION}/${SHORT_VERSION}/g") | |
echo "FINAL_URL=$FINAL_URL" >> $GITHUB_ENV | |
echo "SHORT_VERSION=$SHORT_VERSION" >> $GITHUB_ENV | |
echo "Detected latest Version: ${{ steps.latest_release.outputs.result }}" | |
echo "Final URL: $FINAL_URL" | |
echo "Short Version: $SHORT_VERSION" | |
- name: Update Package | |
uses: michidk/run-komac@latest | |
with: | |
komac-version: "2.8.0" | |
args: "update hrzlgnm.mdns-browser --version $SHORT_VERSION --urls $FINAL_URL --submit --token=${{ secrets.WINGET_TOKEN }}" | |
cleanup: | |
name: Cleanup branches | |
needs: publish | |
runs-on: ubuntu-24.04 | |
steps: | |
- name: Run Komac | |
uses: michidk/run-komac@latest | |
with: | |
komac-version: "2.8.0" | |
args: "cleanup --only-merged --token=${{ secrets.WINGET_TOKEN }}" |