Generate Release #283
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: Generate Release | |
on: | |
workflow_run: | |
workflows: | |
- 'Update Version' | |
types: | |
- 'completed' | |
defaults: | |
run: | |
shell: | | |
pwsh -noninteractive -command "try {{ $ErrorActionPreference='Stop'; . '{0}' }} catch {{ Write-Error ""FAILED: $_""; throw; }} if ((Test-Path -LiteralPath variable:\LASTEXITCODE)) {{ exit $LASTEXITCODE }}" | |
jobs: | |
build-release: # Only run on successful version update action | |
runs-on: windows-latest | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
env: | |
DOTNET_NOLOGO: true | |
DOTNET_CLI_TELEMETRY_OPTOUT: true | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ github.ref }}' | |
fetch-depth: 0 | |
- uses: actions/setup-dotnet@main | |
with: | |
dotnet-version: 6.0.x | |
- name: Create Staging Directory | |
run: mkdir "STAGING" | |
- name: Build VolumeControl Binary | |
run: dotnet publish VolumeControl -c Release -p:PublishProfile="VolumeControl/Properties/PublishProfiles/FolderProfile.pubxml" | |
- name: Stage Binary | |
run: foreach($file in $((dir "publish" | where {$_.extension -in ".exe"}).Fullname)){ mv "$file" "STAGING" } | |
- name: Prepare Installer Prerequisites | |
id: InitInstaller | |
run: | | |
echo AppVersion="$(git describe --tags --abbrev=0)" >> "$GITHUB_OUTPUT" | |
git clone https://github.com/DomGries/InnoDependencyInstaller | |
- name: Build VolumeControl Binary for Installer | |
run: dotnet publish VolumeControl -c Release-ForInstaller -p:PublishProfile="VolumeControl/Properties/PublishProfiles/PublishForInstaller.pubxml" | |
- name: Build VolumeControl Installer | |
uses: Minionguyjpro/Inno-Setup-Action@v1.1.0 | |
with: | |
path: vcsetup.iss | |
options: /dAppVersion="${{ steps.InitInstaller.outputs.AppVersion }}" /Opublish | |
- name: Stage Installer | |
run: foreach($file in $((dir "publish" | where {$_.extension -in ".exe"}).Fullname)){ mv "$file" "STAGING" } | |
- name: Upload Executable Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-windows | |
path: '${{github.workspace}}/STAGING/*' | |
if-no-files-found: error | |
- name: Upload SDK Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: sdk | |
path: '${{github.workspace}}/publish/SDK/*' | |
if-no-files-found: error | |
- name: Authenticate with Github NuGet Package Registry | |
run: dotnet nuget add source --username radj307 --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/radj307/index.json" | |
- name: Pack SDK NuGet Packages | |
run: dotnet pack ./VolumeControl.SDK/VolumeControl.SDK.csproj --noLogo -c Release -o . --include-symbols | |
- name: Upload SDK NuGet Packages | |
run: foreach ($pkg in $(Get-ChildItem -Filter *.nupkg)) { dotnet nuget push $pkg.Name -k ${{ github.token }} -s https://nuget.pkg.github.com/radj307/index.json --skip-duplicate ; dotnet nuget push $pkg.Name -k ${{ secrets.NUGET_API_KEY_VOLUMECONTROLSDK }} -s https://api.nuget.org/v3/index.json --skip-duplicate } | |
# Create the release using the uploaded artifact on github: | |
create-release: | |
needs: build-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: ${{github.workspace}} | |
- name: Stage Artifacts | |
run: | | |
cd ${{github.workspace}}/sdk | |
zip -T9 ../SDK.zip ./* | |
cd ${{github.workspace}} | |
- run: ls -lAghR | |
- name: 'Create Release' | |
uses: softprops/action-gh-release@v1 | |
with: | |
draft: true | |
fail_on_unmatched_files: true | |
files: | | |
${{github.workspace}}/build-windows/VolumeControl.exe | |
${{github.workspace}}/build-windows/VolumeControl-Installer.exe | |
${{github.workspace}}/SDK.zip |