-
-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix build configuration and add release workflow
- Loading branch information
Showing
5 changed files
with
161 additions
and
111 deletions.
There are no files selected for viewing
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
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,32 @@ | ||
name: 'CI Build' | ||
name: 'Build App Package' | ||
|
||
env: | ||
BUILD_NUMBER: '1970.1.1' | ||
BuildDirectory: '${{github.workspace}}\build' | ||
ACTIONS_RUNNER_DEBUG: true | ||
|
||
on: [push, pull_request] | ||
on: | ||
workflow_call: | ||
inputs: | ||
build_configuration: | ||
description: 'The build configuration to use' | ||
type: string | ||
required: true | ||
default: 'Release' | ||
bundle_Platforms: | ||
type: string | ||
description: 'Defines the platforms for the app package.' | ||
required: false | ||
default: ' x86|x64|ARM' | ||
output_directory: | ||
type: string | ||
description: 'Defines the output directory for the app package' | ||
required: false | ||
default: '${{github.workspace}}\build' | ||
build_number: | ||
type: string | ||
description: 'The build number to use' | ||
required: true | ||
|
||
jobs: | ||
build: | ||
|
@@ -19,13 +40,21 @@ jobs: | |
path: repo | ||
clean: true | ||
|
||
- name: Update Version Number in app files | ||
id: update-packageverion | ||
shell: pwsh | ||
run: | | ||
Set-Location ${{github.action_path}}/ | ||
$version = [System.Version]::Parse('${{inputs.build_number}}') | ||
./Set-Version.ps1 -SourceDirectory '${{github.workspace}}\repo\src\' -Major $version.Major -Minor $version.Minor -Build $version.Build -Revision 0 -SetVersion | ||
- name: Setup NuGet.exe for use with actions | ||
uses: NuGet/[email protected] | ||
with: | ||
nuget-version: 'latest' | ||
|
||
- name: setup-msbuild | ||
uses: microsoft/setup-msbuild@v1 | ||
uses: microsoft/setup-msbuild@v2 | ||
|
||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
|
@@ -63,20 +92,22 @@ jobs: | |
run: | | ||
.\.sonar\scanner\dotnet-sonarscanner begin /k:"openhab_openhab-windows" /o:"openhab" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" | ||
- name: Build App | ||
id: create_app_package | ||
uses: ./repo/.github/workflows/actions/app-build | ||
with: | ||
build_configuration: 'debug' | ||
output_directory: '${{env.BuildDirectory}}' | ||
bundle_Platforms: 'x86' | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} | ||
- name: Build OpenHab Windows App | ||
shell: pwsh | ||
run: | | ||
Write-Host "==== Build app package ====" -ForegroundColor Green | ||
msbuild.exe ${{github.workspace}}\repo\OpenHAB.Windows.sln /p:Platform="x86" /p:AppxBundlePlatforms="${{inputs.bundle_Platforms}}" /p:AppxPackageDir="${{inputs.output_directory}}" /p:AppxBundle=Always /p:UapAppxPackageBuildMode=StoreUpload /p:configuration="${{inputs.build_configuration}}" /t:rebuild | ||
- name: End SonarQube analyze | ||
env: | ||
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | ||
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}} | ||
shell: pwsh | ||
run: | | ||
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | ||
.\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" | ||
- name: Upload App Package | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: app | ||
path: ${{env.BuildDirectory}} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
name: 'openHAB Build and Release app' | ||
run-name: app-${{github.run_id }} | ||
|
||
env: | ||
BUILD_NUMBER: '1970.1.1' | ||
BuildDirectory: '${{github.workspace}}\build' | ||
ACTIONS_RUNNER_DEBUG: true | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
BetaRelease: | ||
description: 'Specifices if a beta release should be created.' | ||
default: 'false' | ||
required: false | ||
BuildConfiguration: | ||
description: 'Specifices if a release or debug package should be created.' | ||
default: 'release' | ||
required: false | ||
IsBetaRelease: | ||
description: 'Specifices if a beta release should be created.' | ||
default: 'false' | ||
required: false | ||
|
||
jobs: | ||
configure: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
build_configuration: ${{ steps.detect-build-configuration.outputs.BuildConfiguration }} | ||
bundle_Platforms: ${{ steps.detect-build-configuration.outputs.BundlePlatforms }} | ||
build_number: ${{ steps.set-buildnumbe.outputs.BUILD_NUMBER }} | ||
release_name: ${{ steps.set-buildnumbe.outputs.ReleaseName }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Detect Build Configuration | ||
id: detect-build-configuration | ||
shell: pwsh | ||
run: | | ||
if ($env:github.ref -eq 'refs/heads/main') { | ||
echo "BuildConfiguration=release" >> $GITHUB_OUTPUT | ||
echo "BundlePlatforms=x86|x64|ARM" >> $GITHUB_OUTPUT | ||
} else { | ||
echo "BuildConfiguration=debug" >> $GITHUB_OUTPUT | ||
echo "BundlePlatforms=x86" >> $GITHUB_OUTPUT | ||
} | ||
- name: Set build number and release name | ||
id: set-buildnumbe | ||
shell: pwsh | ||
run: | | ||
$CURRENTDATE = Get-Date -Format "yyyy.MM.dd" | ||
Write-Host "BUILD_NUMBER=${CURRENTDATE}.${{github.run_number}}" >> $env:GITHUB_OUTPUT | ||
$IS_BETA_RELEASE = ${{ inputs.IsBetaRelease }} | ||
if ($IS_BETA_RELEASE) { | ||
Write-Host "ReleaseName=Beta:${CURRENTDATE}.${{github.run_number}}" >> $env:GITHUB_OUTPUT | ||
} else { | ||
Write-Host "ReleaseName=${CURRENTDATE}.${{github.run_number}}" >> $env:GITHUB_OUTPUT | ||
} | ||
build: | ||
uses: ./.github/workflows/build.yml | ||
needs: configure | ||
with: | ||
build_configuration: ${{needs.configure.outputs.build_configuration}} | ||
bundle_Platforms: ${{ needs.configure.outputs.bundle_Platforms}} | ||
build_number: ${{ needs.configure.outputs.build_number}} | ||
secrets: inherit | ||
|
||
create_release: | ||
needs: build | ||
uses: ./.github/workflows/release.yml | ||
with: | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: App Release | ||
|
||
env: | ||
BuildDirectory: '${{github.workspace}}\build' | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
BetaRelease: | ||
description: 'Specifices if a beta release should be created.' | ||
default: 'false' | ||
required: false | ||
BuildConfiguration: | ||
description: 'Specifices if a release or debug package should be created.' | ||
default: 'release' | ||
required: false | ||
build_number: | ||
type: string | ||
description: 'The build number to use' | ||
required: true | ||
|
||
jobs: | ||
release: | ||
name: 'Creates an app release' | ||
runs-on: ubuntu-latest | ||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/releases/beta' | ||
steps: | ||
- name: Download a App Package from Build Artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: app | ||
path: '${{env.BuildDirectory}}' | ||
|
||
- name: Create a Release | ||
id: create_release | ||
uses: "marvinpinto/action-automatic-releases@latest" | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
automatic_release_tag: ${{inputs.build_number}} | ||
title: ${{inputs.build_number}} |