Remotely/.github/workflows/build.yml
Jared Goodwin 3ef4cdf81a
Extract remote control functionality into separate library. (#539)
* Convert server to new single-file startup model.

* Add remote control implementations.

* Implement IViewerAuthorizer.

* Update hub endpoints.

* Implement HubEventHandler.

* Implement ViewerHubDataProvider.

* Implement page data provider.

* Implement RCL and refactor.

* Update submodule.

* Replace submodule with NuGet.

* Update copy URL.

* Update NuGet.

* Remove deprecated WebRTC.

* Remove deprecated WebRTC.

* Update Immense.RemoteControl

* Building out desktop projects.

* Bring more services into submodule.

* Update submodule.

* Update submodule.

* Refactoring for module.

* Update submodule.

* Update submodule

* Got Windows desktop app running.

* Refactor for submodule changes.

* FIx unattended session start.

* Switch desktop app out of console mode.

* Fix tests.

* Update publishing.

* Remove ClickOnce middleware.

* Remove ClickOnce remnants.

* Update submodule

* Add some logging.

* Update Linux path.

* Update submodule.

* Add cleanup service for unattended sessions that failed to start.

* Update submodule.

* Fix chat.

* Add ValidateExecutableReferencesMatchSelfContained property.

* Add other submodule projects.  Align checkbox.

* Update submodule.  Reduce deserialization in the browser, resulting in faster renders.

* Update submodule.

* Update submodule.

* Update submodule.

* Update submodule.

* Add orgId back for branding.

* Get branding loading in desktop apps.

* Update submodule.

* Create log dir.

* Refactor version check on config page.

* Update submodule.

* Update submodule.

* Change submodule URL.

* Correct namespace.

* Update submodule.

* Checkout submodules recursively.
2022-12-23 06:39:12 -08:00

205 lines
7.3 KiB
YAML

# IMPORTANT:
# 1. The Server URL must include the scheme (e.g. https://app.remotely.one).
# 2. The Server Runtime Identifier determines the target operating system
# for which to build the server. The default "linux-x64" will usually work
# for most Linux-based operating systems. You can see a full list at
# https://docs.microsoft.com/en-us/dotnet/core/rid-catalog.
# 2. You'll want to keep your fork updated so you can build the latest
# changes. On the GitHub page for your repo, you'll see a message that says,
# "This branch is ## commits behind lucent-sea:master."
#
# Click the "Pull request" link next to it.
#
# On the next page click the "switching the base" link. Now it's pulling from
# my repo into yours. Create and complete the pull request to update your repo.
#
# Once your branch has been updated, you can run this workflow again
# to build the latest version.
name: Build
on:
workflow_dispatch:
inputs:
serverUrl:
description: 'Server URL'
required: true
rid:
description: 'Server Runtime Identifier'
required: false
default: "linux-x64"
jobs:
build-mac:
runs-on: macos-10.15
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive
- name: Install .NET Core
uses: actions/setup-dotnet@v1.9.0
with:
dotnet-version: 6.0.x
- name: Setup NuGet.exe for use with actions
uses: NuGet/setup-nuget@v1.0.5
- name: Set current version
shell: pwsh
run: |
$VersionString = git show -s --format=%ci
$VersionDate = [DateTimeOffset]::Parse($VersionString)
$Year = $VersionDate.Year.ToString()
$Month = $VersionDate.Month.ToString().PadLeft(2, "0")
$Day = $VersionDate.Day.ToString().PadLeft(2, "0")
$Hour = $VersionDate.Hour.ToString().PadLeft(2, "0")
$Minute = $VersionDate.Minute.ToString().PadLeft(2, "0")
$CurrentVersion = "$Year.$Month.$Day.$Hour$Minute"
echo "CurrentVersion=$CurrentVersion" >> $env:GITHUB_ENV
Write-Host "Setting current version to $CurrentVersion."
- name: Publish macOS x64 Agent
shell: pwsh
run: |
$VersionString = git show -s --format=%ci
$VersionDate = [DateTimeOffset]::Parse($VersionString)
$Year = $VersionDate.Year.ToString()
$Month = $VersionDate.Month.ToString().PadLeft(2, "0")
$Day = $VersionDate.Day.ToString().PadLeft(2, "0")
$Hour = $VersionDate.Hour.ToString().PadLeft(2, "0")
$Minute = $VersionDate.Minute.ToString().PadLeft(2, "0")
$CurrentVersion = "$Year.$Month.$Day.$Hour$Minute"
Write-Host "Publishing agent with version $CurrentVersion"
dotnet publish /p:Version=$CurrentVersion /p:FileVersion=$CurrentVersion --runtime osx-x64 --configuration Release --output "./Agent/bin/publish/" "./Agent/"
Compress-Archive -Path "./Agent/bin/publish/*" -DestinationPath "./Agent/bin/Remotely-MacOS-x64.zip" -Force
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
path: ./Agent/bin/Remotely-MacOS-x64.zip
name: Mac-Agent-x64
build-windows:
runs-on: windows-latest # For a list of available runner types, refer to
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on
needs: build-mac
env:
Solution_Name: Remotely.sln
Configuration: Release
PfxBase64: ${{ secrets.BASE64_ENCODED_PFX }}
PfxKey: ${{ secrets.PFX_KEY }}
ServerUrl: ${{ github.event.inputs.serverUrl }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
# Comment out the below 'repository' line if you want to build from
# your fork instead of the author's.
repository: immense/Remotely
submodules: recursive
fetch-depth: 0
# Test the Server URL to make sure it's valid
- name: Check Server URL Format
run: |
$Result = ""
if (![System.Uri]::TryCreate($env:ServerUrl, [System.UriKind]::Absolute, [ref] $Result)) {
throw "Server URL is not in the correct format. It should be fully qualified with scheme and host (e.g. https://app.remotely.one)."
}
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v1.9.0
with:
dotnet-version: 6.0.x
# Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild
- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1
# Execute all unit tests in the solution
- name: Execute unit tests
run: dotnet test
# Restore the application to populate the obj folder with RuntimeIdentifiers
- name: Restore the application
run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration
# Decode the base 64 encoded pfx and save the Signing_Certificate
- name: Decode the pfx
run: |
if (!($env:PfxBase64)) {
echo "Skipping cert signing because Base64_Encoded_Pfx secret is missing."
return
}
echo "Creating Pfx for signing assemblies."
$pfx_cert_byte = [System.Convert]::FromBase64String($env:PfxBase64)
$certificatePath = Join-Path -Path $env:GITHUB_WORKSPACE -ChildPath GitHubActionsWorkflow.pfx
echo "Writing file to $certificatePath."
[IO.File]::WriteAllBytes($certificatePath, $pfx_cert_byte)
# Store the assembly version in an environment variable
- name: Set current version
shell: powershell
run: |
$VersionString = git show -s --format=%ci
$VersionDate = [DateTimeOffset]::Parse($VersionString)
$Year = $VersionDate.Year.ToString()
$Month = $VersionDate.Month.ToString().PadLeft(2, "0")
$Day = $VersionDate.Day.ToString().PadLeft(2, "0")
$Hour = $VersionDate.Hour.ToString().PadLeft(2, "0")
$Minute = $VersionDate.Minute.ToString().PadLeft(2, "0")
$CurrentVersion = "$Year.$Month.$Day.$Hour$Minute"
echo "CurrentVersion=$CurrentVersion" >> $env:GITHUB_ENV
Write-Host "Setting current version to $CurrentVersion."
- name: Download macOS x64 Agent
uses: actions/download-artifact@v2
with:
name: Mac-Agent-x64
path: ./Server/wwwroot/Content/
# Run the Publish script to build clients and server.
- name: Run Publish script
shell: powershell
run: |
.\Utilities\Publish.ps1 -CertificatePath "$env:GITHUB_WORKSPACE\GitHubActionsWorkflow.pfx" -CertificatePassword $env:PfxKey -Hostname $env:ServerUrl -CurrentVersion $env:CurrentVersion -RID ${{ github.event.inputs.rid }} -OutDir "$env:GITHUB_WORKSPACE\publish"
# Upload build artifact to be deployed from Ubuntu runner
- name: Upload build artifact
uses: actions/upload-artifact@v2
with:
path: ./publish/
name: Server
# Remove the pfx
- name: Remove the pfx
run: |
if (Test-Path "$env:GITHUB_WORKSPACE\GitHubActionsWorkflow.pfx") {
Remove-Item -path "$env:GITHUB_WORKSPACE\GitHubActionsWorkflow.pfx"
}