Skip to content

Tag and Create Release #122

Tag and Create Release

Tag and Create Release #122

# Run workflow to create a release+tag based on version of app set in GlobalAssemblyInfo.cs
name: Tag and Create Release
on: workflow_dispatch
jobs:
build:
name: Build
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
language: [csharp]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup .NET Core
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-quality: 'ga'
- name: Check SDK version
run: dotnet --list-sdks
- name: Build
run: dotnet build -c CLI
- name: Build GUI
run: dotnet build DBADashGUI -o DBADashBuild\DBADashGUIOnly
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v2
- name: Build DB
run: msbuild dbadashdb -property:Configuration=CLI
- name: Get Version
id: GetVersion
shell: powershell
run: |
$path = [System.IO.Path]::Combine((Get-Location),"DBADashBuild\CLI\DBADash.dll")
$version = [System.Reflection.Assembly]::LoadFrom($path).GetName().Version
$version.ToString(3)
Write-Output "BUILD_NUMBER=$($version.ToString(3))" >> $env:GITHUB_OUTPUT
- name: Get Build Reference
id: GetBuildReference
shell: powershell
run: |
Invoke-WebRequest -Uri 'https://dataplat.github.io/assets/dbatools-buildref-index.json' -OutFile 'DBADashBuild\CLI\BuildReference.json'
- name: Zip
shell: powershell
run: |
$zipPath = "DBADash_${{steps.GetVersion.outputs.BUILD_NUMBER}}.zip"
Compress-Archive -Path "DBADashBuild\CLI\*" -DestinationPath $zipPath
$guiZipPath = "DBADash_GUI_Only_${{steps.GetVersion.outputs.BUILD_NUMBER}}.zip"
Compress-Archive -Path "DBADashBuild\DBADashGUIOnly\*" -DestinationPath $guiZipPath
- name: Publish - GitHub CLI
run: gh release create ${{steps.GetVersion.outputs.BUILD_NUMBER}} "DBADash_${{steps.GetVersion.outputs.BUILD_NUMBER}}.zip" "DBADash_GUI_Only_${{steps.GetVersion.outputs.BUILD_NUMBER}}.zip" --generate-notes --notes-file ReleaseNotes.md --draft
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}