Add name to Server artifact. Update installer. Update packages.

This commit is contained in:
Jared Goodwin 2021-05-12 04:59:18 -07:00
parent 40c49e4efb
commit aac8db5cc6
12 changed files with 26 additions and 423 deletions

View File

@ -186,6 +186,7 @@ jobs:
uses: actions/upload-artifact@v2
with:
path: ./publish/
name: Server
# Remove the pfx

View File

@ -1,201 +0,0 @@
# To use this workflow to deploy Remotely:
#
# 1. Create the site in IIS, if you haven't already.
#
# 2. Set up MSDeploy on the site.
# - Right-click the site.
# - Go to Deploy - Configure Web Deploy Publishing.
# - Select the user account to use for publishing.
# - Click OK.
#
# 2. Create the below Secrets in GitHub.
# - BASE64_ENCODED_PFX
# - See below section to get this string.
# - PFX_KEY
# - The password for the certificate.
# - MSDEPLOY_USERNAME
# - The username selected when configuring MSDeploy.
# - MSDEPLOY_PASSWORD
# - The password for the above user.
# - IIS_APP_PATH
# - The IIS site name.
# - SITE_URL
# - The public URL of the website (e.g. https://app.remotely.one).
#
# Secrets are created in GitHub under the repository (your forked repository,
# not the lucent-sea/Remotely repository). They are only usable by you and
# collaborators that you've allowed on your repo. After being set, they are
# not visible or displayed anywhere, even to yourself.
#
# If you don't want to sign your EXEs, skip creating the BASE64_ENCODED_PFX
# and PFX_KEY secrets. They won't be used.
#
#
# 3. Getting the Base64-Encoded PFX
# To get the base64-encoded certificate, use the below PowerShell snippet,
# using your PFX file name.
#
# $Pfx_Cert = Get-Content '.\Remotely_Cert.pfx' -Encoding Byte
# [System.Convert]::ToBase64String($Pfx_Cert) | clip
#
# The base64-encoded string is now in your clipboard. You can paste
# it into GitHub when creating the Secret.
#
# 4. Deploying to IIS
# On GitHub, go to your forked repo, then to Actions. On the left, select
# "Deploy to IIS" action underneath "All Workflows". There should be a
# banner saying "This workflow has a workflow_dispatch event trigger."
#
# Click "Run workflow" and select the branch you want to deploy.
#
# 5. Keeping Your Fork Updated
# You'll want to keep your fork updated so you can deploy the latest
# changes. There are a few ways to do it, and they're easy to find
# with a little Googling.
#
# Once your branch has been updated, you can run the
# workflow again manually in GitHub to re-deploy.
name: Deploy To IIS
on:
# Uncomment these for automatic deployment.
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
configuration: [Release]
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
env:
Solution_Name: Remotely.sln # Replace with your solution name, i.e. MyWpfApp.sln.
Configuration: ${{ matrix.configuration }}
Test_Project_Path: Tests\Tests.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj.
PfxBase64: ${{ secrets.BASE64_ENCODED_PFX }}
PfxKey: ${{ secrets.PFX_KEY }}
MsDeployUsername: ${{ secrets.MSDEPLOY_USERNAME }}
MsDeployPassword: ${{ secrets.MSDEPLOY_PASSWORD }}
IisAppPath: ${{ secrets.IIS_APP_PATH }}
SiteUrl: ${{ secrets.SITE_URL }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v1.7.2
# 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 "::set-env name=CurrentVersion::$CurrentVersion"
# This was needed in Azure Pipelines.
#[System.Console]::WriteLine("##vso[task.setvariable variable=CurrentVersion]$CurrentVersion")
Write-Host "Setting current version to $CurrentVersion."
# Create MSDeploy Publishing Profile
- name: Create MSDeploy Profile
shell: powershell
run: |
$PublishProfile = @"
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>MSDeploy</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>x64</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish>$($env:SiteUrl):80/</SiteUrlToLaunchAfterPublish>
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<ExcludeApp_Data>False</ExcludeApp_Data>
<ProjectGuid>3e835099-c417-4d82-8d5c-13dc09af48ac</ProjectGuid>
<MSDeployServiceURL>$($env:SiteUrl):8172/msdeploy.axd</MSDeployServiceURL>
<DeployIisAppPath>$env:IisAppPath</DeployIisAppPath>
<RemoteSitePhysicalPath />
<SkipExtraFilesOnServer>True</SkipExtraFilesOnServer>
<MSDeployPublishMethod>WMSVC</MSDeployPublishMethod>
<EnableMSDeployBackup>True</EnableMSDeployBackup>
<UserName>$env:MsDeployUsername</UserName>
<TargetFramework>net5.0</TargetFramework>
<SelfContained>true</SelfContained>
<AllowUntrustedCertificate>true</AllowUntrustedCertificate>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
</Project>
"@
New-Item -Path "$env:GITHUB_WORKSPACE\Server\Properties\PublishProfiles\" -ItemType Directory -Force
Set-Content -Path "$env:GITHUB_WORKSPACE\Server\Properties\PublishProfiles\DeployIIS.pubxml" -Value $PublishProfile -Force
# 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:SiteUrl -CurrentVersion $env:CurrentVersion -RID win-x64 -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/
# Publish server to IIS
- name: Publish
run: |
echo "Publishing with configuration $env:Configuration."
dotnet publish /p:Platform="x64" /p:Configuration="$env:Configuration" /p:PublishProfile="DeployIIS" /p:Password=$env:MsDeployPassword /p:Version=$env:CurrentVersion /p:FileVersion=$env:CurrentVersion ".\Server"
# Remove the pfx
- name: Remove the pfx
run: Remove-Item -path $env:GITHUB_WORKSPACE\GitHubActionsWorkflow.pfx

View File

@ -1,199 +0,0 @@
# To use this workflow to deploy Remotely:
#
# IMPORTANT: You must run the install script as sudo first before using this
# GitHub workflow. This will only deploy the updated files.
# The script will install dependencies, create the systemd
# ervice, create the Nginx site, etc.
#
# 1. Set up SSH on your Ubuntu server. There are plenty of articles on
# the internet that describe the process. Here's a good one:
# https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-1604
#
# It's a good idea to turn off password-based authentication.
#
#
# 2. Create the below Secrets in GitHub.
# - BASE64_ENCODED_PFX
# - See below section to get this string.
# - PFX_KEY
# - The password for the certificate.
# - SSH_USERNAME
# - Username to use for SSH connection.
# - SSH_PRIVATE_KEY
# - The private key to use for SSH.
# - SSH_HOSTNAME
# - The hostname or IP to use for the SSH connection.
# - SSH_KNOWN_HOSTS
# - The content to go into your known_hosts file. This should
# contain the fingerprint for the SSH host (e.g. "{hostname} {public key}")
# - SITE_URL
# - The public hostname for the site (e.g. https://app.remotely.one).
# This can be an IP if it's only going to be used on the local network
# with HTTP.
#
# Secrets are created in GitHub under the repository (your forked repository,
# not the lucent-sea/Remotely repository). They are only usable by you and
# collaborators that you've allowed on your repo. After being set, they are
# not visible or displayed anywhere, even to yourself.
#
# If you don't want to sign your EXEs, skip creating the BASE64_ENCODED_PFX
# and PFX_KEY secrets. They won't be used.
#
#
# 3. Getting the Base64-Encoded PFX
# To get the base64-encoded certificate, use the below PowerShell snippet,
# using your PFX file name.
#
# $Pfx_Cert = Get-Content '.\Remotely_Cert.pfx' -Encoding Byte
# [System.Convert]::ToBase64String($Pfx_Cert) | clip
#
# The base64-encoded string is now in your clipboard. You can paste
# it into GitHub when creating the Secret.
#
#
# 3. Deploying via SSH
#
# On GitHub, go to your forked repo, then to Actions. On the left, select
# "Deploy via SSH" action underneath "All Workflows". There should be a
# banner saying "This workflow has a workflow_dispatch event trigger."
#
# Click "Run workflow" and select the branch you want to deploy.
#
# 5. Keeping Your Fork Updated
# You'll want to keep your fork updated so you can deploy the latest
# changes. There are a few ways to do it, and they're easy to find
# with a little Googling.
#
# Once your branch has been updated, you can run the
# workflow again manually in GitHub to re-deploy.
name: Deploy via SSH
on:
# Uncomment these for automatic deployment.
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]
workflow_dispatch:
jobs:
build:
strategy:
matrix:
configuration: [Release]
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
env:
Solution_Name: Remotely.sln # Replace with your solution name, i.e. MyWpfApp.sln.
Configuration: ${{ matrix.configuration }}
Test_Project_Path: Tests\Tests.csproj # Replace with the path to your test project, i.e. MyWpfApp.Tests\MyWpfApp.Tests.csproj.
PfxBase64: ${{ secrets.BASE64_ENCODED_PFX }}
PfxKey: ${{ secrets.PFX_KEY }}
SiteUrl: ${{ secrets.SITE_URL }}
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
# Install the .NET Core workload
- name: Install .NET Core
uses: actions/setup-dotnet@v1.7.2
# 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 "::set-env name=CurrentVersion::$CurrentVersion"
# This was needed in Azure Pipelines.
#[System.Console]::WriteLine("##vso[task.setvariable variable=CurrentVersion]$CurrentVersion")
Write-Host "Setting current version to $CurrentVersion."
# 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:SiteUrl -CurrentVersion $env:CurrentVersion -RID linux-x64 -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/
# Remove the pfx
- name: Remove the pfx
run: Remove-Item -path "$env:GITHUB_WORKSPACE\GitHubActionsWorkflow.pfx"
deploy:
runs-on: ubuntu-latest
needs: build
env:
SshUsername: ${{ secrets.SSH_USERNAME }}
SshPrivateKey: ${{ secrets.SSH_PRIVATE_KEY }}
SshHostname: ${{ secrets.SSH_HOSTNAME }}
steps:
# Install SSH Key
- name: Install SSH Key
uses: shimataro/ssh-key-action@v2.1.0
with:
# SSH private key
key: ${{ secrets.SSH_PRIVATE_KEY }}
# public keys of SSH servers
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
# Download Build Artifact
- name: Download build artifact
uses: actions/download-artifact@v2
- name: Publish
shell: bash
run: |
rsync -r -v ./artifact/ $SshUsername@$SshHostname:/var/www/remotely/

View File

@ -23,11 +23,11 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="5.0.6" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.EventLog" Version="5.0.0" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.6" />
<PackageReference Include="Microsoft.PowerShell.SDK" Version="7.1.3" />
<PackageReference Include="Microsoft.WSMan.Management" Version="7.1.3" />
<PackageReference Include="Microsoft.WSMan.Runtime" Version="7.1.3" />

View File

@ -40,8 +40,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="5.0.6" />
<PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="5.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="5.0.0" />

View File

@ -52,9 +52,9 @@
<EmbeddedResource Include="Assets\Remotely_Icon.png" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.0" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.0" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.0" />
<PackageReference Include="Avalonia" Version="0.10.4" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.4" />
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Desktop.Core\Desktop.Core.csproj" />

View File

@ -49,8 +49,8 @@ However, you can also choose to install the pre-built packages that do not have
- If you want to use the pre-built package, run the installer now, and you're done!
- Otherwise, follow the below steps for setting up the GitHub Actions integration, then run the installer afterward.
- Fork the repo if you haven't already.
- If you've already forked the repo and haven't updated your fork since the new installer was created, you'll need to do so first.
- You can use the following commands to pull the latest changes, merge them, and push them back up to your repo ([git](https://git-scm.com/downloads) required). Make sure to replace `{your-username}` with your GitHub username.
- If you've already forked the repo and haven't updated your fork recently, you'll need to do so first.
- You can use the following commands to pull the latest changes, merge them, and push them back up to your repo ([git](https://git-scm.com/downloads) required). Make sure to replace `{your-username}` with your GitHub username. This example assumes you've added your SSH key to your GitHub account.
```
git clone git@github.com:{your-username}/remotely
cd ./remotely

View File

@ -95,7 +95,9 @@ namespace Server.Installer.Services
return null;
}
return payload.artifacts.OrderByDescending(x => x.created_at).First();
return payload.artifacts
.OrderByDescending(x => x.created_at)
.FirstOrDefault(x=>x.name.Equals("Server", StringComparison.OrdinalIgnoreCase));
}
catch (Exception ex)
{

View File

@ -24,13 +24,13 @@
<ItemGroup>
<PackageReference Include="MailKit" Version="2.11.1" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.5">
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="5.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="5.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="5.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.MessagePack" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
@ -42,8 +42,8 @@
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.13" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.5" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.6" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.1.4" />
</ItemGroup>
<ItemGroup>

View File

@ -10,7 +10,7 @@
<ItemGroup>
<PackageReference Include="ConcurrentList" Version="1.4.0" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.5" />
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="5.0.6" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Security.Principal.Windows" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="5.0.2" />

View File

@ -8,7 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.5" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="5.0.6" />
</ItemGroup>
<ItemGroup>

View File

@ -23,8 +23,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.6" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
<PackageReference Include="Moq" Version="4.16.1" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />