Skip to content

Commit

Permalink
SKA-195: Automatically Create Releases with Build Artifacts
Browse files Browse the repository at this point in the history
* Added a workflow that creates release builds when tagging commits
* Renamed folder in zip file of the cross-platform build from version number to the same name that the zip file has
* Version bump to 1.0.1
  • Loading branch information
DominikHerr committed Jun 28, 2023
1 parent 7915f1a commit be40037
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 13 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/release-public.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Create Release Package [public]


# Define the triggers for this workflow
on:
push:
tags:
- "v*.*.*"

jobs:
# Get environment variable for docker image URI and provide it to next build step
prep-linux:
runs-on: [Ubuntu-20.04]
outputs:
image: ${{ steps.set_image.outputs.image }}
environment: build-action
steps:
- id: set_image
env:
DOCKER_IMAGE_URI: ${{ vars.DOCKER_IMAGE_URI }}
run: echo "image=${{vars.DOCKER_IMAGE_URI}}" >> "$GITHUB_OUTPUT"


# Build the project, then remove the built artifacts
build-linux:
runs-on: [Ubuntu-20.04]
needs: prep-linux
container:
image: ${{ needs.prep-linux.outputs.image }}
steps:
- run: ls -l
- run: pwd
- run: "echo ImageURI=${{needs.prep-linux.outputs.image}}"
# Check out this Git repo
- uses: actions/checkout@v3
- name: Build & Publish
run: dotnet build ./FmuImporter/BuildAll/Build.csproj -v:m
- name: Release
uses: softprops/action-gh-release@v1
with:
prerelease: true
draft: true
files: |
./FmuImporter/_publish/SilKitFmuImporter-*-xPlatform-x64.zip
30 changes: 19 additions & 11 deletions FmuImporter/BuildAll/Build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
<StandaloneBuild>-p:Standalone=True </StandaloneBuild>
<CrossPlatformBuild>-p:Standalone=False --self-contained=false</CrossPlatformBuild>
</PropertyGroup>
<PropertyGroup>
<PublishPath>$(MSBuildProjectDirectory)/../_publish/</PublishPath>
<CrossPlatformTargetFolderName>SilKitFmuImporter-$(Version)-xPlatform-x64</CrossPlatformTargetFolderName>
</PropertyGroup>

<!-- win-x64 -->
<Exec Command="dotnet build $(BuildPath)SilKitBridge/SilKitBridge.csproj $(DefaultProperties) $(StandaloneBuild) -p:RuntimeIdentifier=win-x64" />
Expand Down Expand Up @@ -39,41 +43,45 @@
<Move SourceFiles="$(MSBuildProjectDirectory)/../_build/crossplatform-x64-Release/FmuImporter"
OverwriteReadOnlyFiles="true"
DestinationFiles="$(MSBuildProjectDirectory)/../_build/crossplatform-x64-Release/FmuImporter.tmp" />
<Move SourceFiles="$(MSBuildProjectDirectory)/../_publish/crossplatform-x64/$(Version)/FmuImporter"
<Move SourceFiles="$(PublishPath)crossplatform-x64/$(CrossPlatformTargetFolderName)/FmuImporter"
OverwriteReadOnlyFiles="true"
DestinationFiles="$(MSBuildProjectDirectory)/../_publish/crossplatform-x64/$(Version)/FmuImporter.tmp" />
DestinationFiles="$(PublishPath)crossplatform-x64/$(CrossPlatformTargetFolderName)/FmuImporter.tmp" />
<Exec Command="dotnet build $(BuildPath)FmuImporter/FmuImporter.csproj $(DefaultProperties) -p:BuildProjectReferences=false $(CrossPlatformBuild) -p:RuntimeIdentifier=win-x64" />
<Exec Command="dotnet publish $(BuildPath)FmuImporter/FmuImporter.csproj $(DefaultProperties) $(CrossPlatformBuild) -p:PublishProfile=publishCrossPlatform-x64 -p:RuntimeIdentifier=win-x64 --no-build" />
<Move SourceFiles="$(MSBuildProjectDirectory)/../_build/crossplatform-x64-Release/FmuImporter.tmp"
OverwriteReadOnlyFiles="true"
DestinationFiles="$(MSBuildProjectDirectory)/../_build/crossplatform-x64-Release/FmuImporter" />
<Move SourceFiles="$(MSBuildProjectDirectory)/../_publish/crossplatform-x64/$(Version)/FmuImporter.tmp"
<Move SourceFiles="$(PublishPath)crossplatform-x64/$(CrossPlatformTargetFolderName)/FmuImporter.tmp"
OverwriteReadOnlyFiles="true"
DestinationFiles="$(MSBuildProjectDirectory)/../_publish/crossplatform-x64/$(Version)/FmuImporter" />
DestinationFiles="$(PublishPath)crossplatform-x64/$(CrossPlatformTargetFolderName)/FmuImporter" />
<Copy
SourceFiles="$(SilKitDirBase)/libSilKit.so;$(SilKitDirBase)/SilKit.dll"
DestinationFolder="$(MSBuildProjectDirectory)/../_build/crossplatform-x64-Release/" />
<Copy
SourceFiles="$(SilKitDirBase)/libSilKit.so;$(SilKitDirBase)/SilKit.dll"
DestinationFolder="$(MSBuildProjectDirectory)/../_publish/crossplatform-x64/$(Version)/" />
DestinationFolder="$(PublishPath)crossplatform-x64/$(CrossPlatformTargetFolderName)/" />
</Target>

<Target Name="Prepare cross-platform release package"
AfterTargets="BuildAll">
<PropertyGroup>
<PublishPath>$(MSBuildProjectDirectory)/../_publish/</PublishPath>
<CrossPlatformTargetFolderName>SilKitFmuImporter-$(Version)-xPlatform-x64</CrossPlatformTargetFolderName>
</PropertyGroup>
<Message Text="Adding license information to cross-platform build..." Importance="High" />
<Copy
SourceFiles="$(MSBuildProjectDirectory)/../../CHANGELOG.md"
DestinationFolder="$(MSBuildProjectDirectory)/../_publish/crossplatform-x64/$(Version)/" />
DestinationFolder="$(PublishPath)crossplatform-x64/$(CrossPlatformTargetFolderName)/" />
<Copy
SourceFiles="$(MSBuildProjectDirectory)/../../LICENSE"
DestinationFolder="$(MSBuildProjectDirectory)/../_publish/crossplatform-x64/$(Version)/" />
DestinationFolder="$(PublishPath)crossplatform-x64/$(CrossPlatformTargetFolderName)/" />
<Copy
SourceFiles="$(MSBuildProjectDirectory)/../../ThirdParty/LICENSES.rst"
DestinationFolder="$(MSBuildProjectDirectory)/../_publish/crossplatform-x64/$(Version)/ThirdParty/" />
DestinationFolder="$(PublishPath)crossplatform-x64/$(CrossPlatformTargetFolderName)/ThirdParty/" />

<Message Text="Zipping cross-platform build to '$(MSBuildProjectDirectory)/../_publish/SilKitFmuImporter-$(Version)-xPlatform-x64.zip'..." Importance="High" />
<ZipDirectory SourceDirectory="$(MSBuildProjectDirectory)/../_publish/crossplatform-x64/"
DestinationFile="$(MSBuildProjectDirectory)/../_publish/SilKitFmuImporter-$(Version)-xPlatform-x64.zip"
<Message Text="Zipping cross-platform build to '$(PublishPath)$(CrossPlatformTargetFolderName).zip'..." Importance="High" />
<ZipDirectory SourceDirectory="$(PublishPath)crossplatform-x64/"
DestinationFile="$(PublishPath)/$(CrossPlatformTargetFolderName).zip"
Overwrite="True" />
</Target>
</Project>
4 changes: 2 additions & 2 deletions FmuImporter/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
<Version>1.0.0</Version>
<Version>1.0.1</Version>
<Copyright>Copyright (c) Vector Informatik GmbH. All rights reserved.</Copyright>
</PropertyGroup>

Expand Down Expand Up @@ -73,7 +73,7 @@
<PropertyGroup Condition="$(Standalone) != 'True'">
<IntermediateOutputPath>$(MSBuildProjectDirectory)\..\_obj\crossplatform-$(Platform)-$(Configuration)</IntermediateOutputPath>
<OutputPath>$(MSBuildProjectDirectory)\..\_build\crossplatform-$(Platform)-$(Configuration)</OutputPath>
<PublishDir>$(MSBuildProjectDirectory)\..\_publish\crossplatform-$(Platform)\$(Version)</PublishDir>
<PublishDir>$(MSBuildProjectDirectory)\..\_publish\crossplatform-$(Platform)\SilKitFmuImporter-$(Version)-xPlatform-$(Platform)</PublishDir>
<OsDefined>True</OsDefined>
</PropertyGroup>

Expand Down

0 comments on commit be40037

Please sign in to comment.