Create Release #1
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: Create Release | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: [ "win-x64", "linux-x64" ] | |
runs-on: ubuntu-latest | |
env: | |
Solution_Name: SIT.Manager.sln | |
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 }} | |
# Compress the published output for both Windows and Linux | |
- name: Compress on Linux | |
if: ${{ matrix.os == 'linux-x64' }} | |
run: | | |
cd ${{ github.workspace }}/SIT.Manager.Desktop/bin/Release/net8.0/${{ matrix.os }}/publish/ | |
tar -czvf ${{ matrix.os }}.tar.gz * | |
- name: Compress on Windows | |
if: ${{ matrix.os == 'win-x64' }} | |
run: | | |
cd ${{ github.workspace }}/SIT.Manager.Desktop/bin/Release/net8.0/${{ matrix.os }}/publish/ | |
zip -r ${{ matrix.os }}.zip * | |
# Get the build version for both Windows and Linux | |
- name: Get Release Version | |
if: ${{ matrix.os == 'linux-x64' }} | |
run: | | |
VersionString=`strings ${{ github.workspace }}/SIT.Manager.Desktop/bin/Release/net8.0/${{ matrix.os }}/publish/SIT.Manager | egrep -m 1 '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'` | |
echo "RELEASE_VERSION=$VersionString" >> "$GITHUB_ENV" | |
- name: Get Release Version | |
if: ${{ matrix.os == 'win-x64' }} | |
run: | | |
VersionString=`strings ${{ github.workspace }}/SIT.Manager.Desktop/bin/Release/net8.0/${{ matrix.os }}/publish/SIT.Manager.exe | egrep -m 1 '^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$'` | |
echo "RELEASE_VERSION=$VersionString" >> "$GITHUB_ENV" | |
- name: Output Release Tag | |
id: tag | |
run: | | |
TAG=$RELEASE_VERSION | |
echo "$TAG" | |
echo "tag=$TAG" >> $GITHUB_OUTPUT | |
# Create release as draft from the compressed output | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
generate_release_notes: true | |
files: ${{ github.workspace }}/SIT.Manager.Desktop/bin/Release/net8.0/${{ matrix.os }}/publish/${{ matrix.os }}.* | |
tag_name: ${{ steps.tag.outputs.tag }} |