mirror of
https://github.com/riegera2412/UVtools.git
synced 2026-07-08 17:42:31 +02:00
68 lines
2.6 KiB
YAML
68 lines
2.6 KiB
YAML
name: Winget and Nuget package publish
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
env:
|
|
WINGET_PACKAGE_NAME: .+win-x64.+\.msi
|
|
WINGET_PACKAGE_ID: PTRTECH.UVtools
|
|
WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
|
|
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
|
|
|
|
jobs:
|
|
|
|
winget:
|
|
name: Winget - Pull request
|
|
runs-on: windows-latest
|
|
timeout-minutes: 10
|
|
steps:
|
|
- name: Download WingetCreate.exe
|
|
run: iwr -Uri https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
|
|
- name: Set VERSION variable from tag
|
|
run: |
|
|
$github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
|
|
$version = $github.release.tag_name.Replace('v', '')
|
|
if($version.Length -lt 5)
|
|
{
|
|
Write-Error "Version $version is too short!"
|
|
exit -1
|
|
}
|
|
Write-Output "Version: ${version}"
|
|
"VERSION=${version}" >> $env:GITHUB_ENV
|
|
- name: Set INSTALLER_URL variable from release asset
|
|
run: |
|
|
$github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
|
|
$installerUrl = $github.release.assets | Where-Object -Property name -match "${env:WINGET_PACKAGE_NAME}" | Select -ExpandProperty browser_download_url -First 1
|
|
if($null -eq $installerUrl)
|
|
{
|
|
Write-Error "Installer URL not found on ${github.release.assets}"
|
|
exit -1
|
|
}
|
|
Write-Output "Installer url: ${installerUrl}"
|
|
"INSTALLER_URL=${installerUrl}" >> $env:GITHUB_ENV
|
|
- name: Submit package to Windows Package Manager Community Repository
|
|
run: .\wingetcreate.exe update ${env:WINGET_PACKAGE_ID} --version ${env:VERSION} --urls ${env:INSTALLER_URL} --token ${env:WINGET_TOKEN} --submit
|
|
|
|
nuget:
|
|
name: Nuget - Publish package
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v2
|
|
- name: Verify commit exists in origin/master
|
|
run: |
|
|
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
|
|
git branch --remote --contains | grep origin/master
|
|
- name: Set VERSION variable from tag
|
|
run: |
|
|
VERSION=${{ github.event.release.tag_name }}
|
|
echo "VERSION=${VERSION:1}" >> $GITHUB_ENV
|
|
- name: Build
|
|
run: dotnet build --configuration Release
|
|
- name: Pack
|
|
run: dotnet pack UVtools.Core --configuration Release --no-build --output .
|
|
- name: Push nuget.org
|
|
run: dotnet nuget push UVtools.Core.${VERSION}.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_TOKEN}
|