sunshine-sdk/.github/workflows/update-winget-release.yml
LizardByte-bot 1df4c89026
chore: update global workflows (#3813)
Co-authored-by: ReenigneArcher <42013603+ReenigneArcher@users.noreply.github.com>
2025-04-25 19:09:06 -04:00

72 lines
2.2 KiB
YAML

---
# This workflow is centrally managed in https://github.com/<organization>/.github/
# Don't make changes to this file in this repo as they will be overwritten with changes made to the same file in
# the above-mentioned repo.
# To use, add the `winget-pkg` repository label to identify repositories that should trigger this workflow.
# Update Winget on release events.
name: Update Winget release
permissions:
contents: read
on:
release:
types:
- released
concurrency:
group: "${{ github.workflow }}-${{ github.event.release.tag_name }}"
cancel-in-progress: true
jobs:
update-winget-release:
if: github.repository_owner == 'LizardByte'
runs-on: ubuntu-latest
steps:
- name: Check if Winget repo
id: check-label
env:
TOPIC: winget-pkg
uses: actions/github-script@v7
with:
script: |
const topic = process.env.TOPIC;
console.log(`Checking if repo has topic: ${topic}`);
const repoTopics = await github.rest.repos.getAllTopics({
owner: context.repo.owner,
repo: context.repo.repo
});
console.log(`Repo topics: ${repoTopics.data.names}`);
const hasTopic = repoTopics.data.names.includes(topic);
console.log(`Has topic: ${hasTopic}`);
core.setOutput('hasTopic', hasTopic);
- name: Download release asset
id: download
if: steps.check-label.outputs.hasTopic == 'true'
uses: robinraju/release-downloader@v1.12
with:
repository: "${{ github.repository }}"
tag: "${{ github.event.release.tag_name }}"
fileName: "*.exe"
tarBall: false
zipBall: false
out-file-path: "release_downloads"
extract: false
- name: Release to WinGet
if: >-
steps.check-label.outputs.hasTopic == 'true' &&
fromJson(steps.download.outputs.downloaded_files)[0]
uses: vedantmgoyal2009/winget-releaser@v2
with:
identifier: "${{ github.repository_owner }}.${{ github.event.repository.name }}"
release-tag: ${{ github.event.release.tag_name }}
installers-regex: '\.exe$'
token: ${{ secrets.GH_BOT_TOKEN }}