Skip to content

Create Release

Create Release #12

name: Create Release
on:
workflow_dispatch:
jobs:
build:
strategy:
matrix:
os: [ "win-x64", "linux-x64" ]
runs-on: ubuntu-latest
env:
DeploymentDirectory: deployment
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup .NET 8.0
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Get build date
id: build
shell: pwsh
run: |
$CurrentTime = Get-Date -Format 'yyMM'
$BuildTime = Get-Date -Format 'ddHH'
Write-Output "NOW=$CurrentTime" >> $env:GITHUB_OUTPUT
Write-Output "VERSION=$BuildTime" >> $env:GITHUB_OUTPUT
- name: Build Published Version
run: dotnet publish SIT.Manager.Desktop/SIT.Manager.Desktop.csproj -c Release -r ${{ matrix.os }} -p:BuildNumber=${{ steps.build.outputs.NOW }} -p:RevisionNumber=${{ steps.build.outputs.VERSION }} -o ${{ env.DeploymentDirectory }}
- name: Upload Artifact
id: artifact-upload
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: ${{ env.DeploymentDirectory }}
if-no-files-found: error
retention-days: 3
release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Get Windows Artifact
uses: actions/download-artifact@v4
with:
name: win-x64
path: win_extracted
- name: Get Linux Artifact
uses: actions/download-artifact@v4
with:
name: linux-x64
path: linux_extracted
- name: Tar Linux Artifact
run: find linux_extracted -printf "%P\n" | tar -czf linux-x64.tar.gz --no-recursion -C linux_extracted -T -
- name: Zip Windows Artifact
run: |
cd win_extracted
zip -r ../win-x64.zip *
cd ..
# Get the build version for tagging the release
- name: Get Release Version
id: tag
run: |
VersionString=`strings win_extracted/SIT.Manager.exe | egrep -m 1 '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'`
echo "MANAGER_VERSION=$VersionString" >> $GITHUB_OUTPUT
- name: Generate Release Draft
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
files: |
win-x64.zip
linux-x64.tar.gz
tag_name: ${{ steps.tag.outputs.MANAGER_VERSION }}