--- # This workflow is centrally managed in https://github.com//.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 }}