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
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- '.github/workflows/Desktop_Build.yml' | |
- '.github/workflows/Test_WinGet.yml' | |
- '.github/workflows/Sign.yml' | |
- 'src/DesktopClient/**' | |
- '*..md' | |
- 'Build/PublishStore/**' | |
- '.chocolatey/**' | |
pull_request: | |
branches: [ main ] | |
paths-ignore: | |
- '.github/workflows/Desktop_Build.yml' | |
- 'src/DesktopClient/**' | |
- 'README.md' | |
- 'desktop-README.md' | |
- 'Build/PublishStore/**' | |
- '.chocolatey/**' | |
jobs: | |
Setup_Web: | |
name: Setup Web | |
runs-on: windows-latest | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
BuildConfiguration: Release | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
GitHubReleaseUrl: https://github.com/isaacrlevin/presencelight/releases/download/Web- | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use .NET Core SDK 8.0.x | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Nerdbank.GitVersioning | |
uses: dotnet/nbgv@v0.4.1 | |
with: | |
setCommonVars: true | |
- run: echo "BuildNumber - ${{ env.GitBuildVersionSimple }}" | |
- name: Update appsettings.json | |
run: | | |
# Update AppSettings.json. This must be done before build. | |
$appsettings= get-content ".\src\PresenceLight.Web\appsettings.json" -raw | ConvertFrom-Json | |
$appsettings.azureAd.clientId = "${{ secrets.ApplicationId }}" | |
$appsettings.azureAd.clientSecret = "${{ secrets.ClientSecret }}" | |
$appsettings.appVersion = "${{ env.GitBuildVersionSimple }}" | |
$appsettings.applicationInsights.instrumentationkey = "${{ secrets.InstrumentationKey }}" | |
$appsettings | ConvertTo-Json -depth 32| set-content '.\src\PresenceLight.Web\appsettings.json' | |
shell: powershell | |
if: ${{ success() && github.event_name != 'pull_request' }} | |
- name: Update PresenceLightSettings.json | |
run: | | |
# Update PresenceLightSettings.json. This must be done before build. | |
$PresenceLightSettings= get-content ".\src\PresenceLight.Web\PresenceLightSettings.json" -raw | ConvertFrom-Json | |
$PresenceLightSettings.lightSettings.lifx.LIFXClientId = "${{ secrets.LIFXClientId }}" | |
$PresenceLightSettings.lightSettings.lifx.LIFXClientSecret = "${{ secrets.LIFXClientSecret }}" | |
$PresenceLightSettings.lightSettings.hue.RemoteHueClientId = "${{ secrets.RemoteHueClientId }}" | |
$PresenceLightSettings.lightSettings.hue.RemoteHueClientSecret = "${{ secrets.RemoteHueClientSecret }}" | |
$PresenceLightSettings.lightSettings.hue.RemoteHueClientAppName = "${{ secrets.RemoteHueClientAppName }}" | |
$PresenceLightSettings | ConvertTo-Json -depth 32| set-content '.\src\PresenceLight.Web\PresenceLightSettings.json' | |
shell: powershell | |
if: ${{ success() && github.event_name != 'pull_request' }} | |
- name: Create Version File to Artifact | |
run : | | |
New-Item -Path ${{ github.workspace }}\Build -Name "version.txt" -ItemType "file" -Value "${{ env.GitBuildVersionSimple }}" | |
shell: powershell | |
- name: Publish Arifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ github.workspace }}\src | |
name: PreBuild | |
- name: Publish signing scripts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: Build | |
name: SigningScripts | |
if: ${{ success() }} | |
Build_Web: | |
name: Build Web | |
needs: Setup_Web | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
include: | |
- ChannelName: Windows_x64_x86 | |
RID: win-x64 | |
- ChannelName: Windows_ARM | |
RID: win-arm64 | |
- ChannelName: macOS | |
RID: osx-x64 | |
- ChannelName: Linux_ARM | |
RID: linux-arm | |
- ChannelName: Linux_ARM64 | |
RID: linux-x64 | |
- ChannelName: Linux_Musl_x64 | |
RID: linux-musl-x64 | |
- ChannelName: Linux_Musl_ARM_x64 | |
RID: linux-musl-arm64 | |
env: | |
DOTNET_CLI_TELEMETRY_OPTOUT: 1 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
BuildConfiguration: Release | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
GitHubReleaseUrl: https://github.com/isaacrlevin/presencelight/releases/download/Web- | |
steps: | |
- name: Use .NET Core SDK 8.0.x | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Download PreBuild | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: PreBuild | |
path: ${{ github.workspace }}/src | |
- uses: actions/download-artifact@v4.1.0 | |
name: Download Signing Scripts Artifacts | |
with: | |
name: SigningScripts | |
path: "${{ github.workspace }}/SigningScripts" | |
- name: Get Version from File | |
run: | | |
version=$(<"${{ github.workspace }}/SigningScripts/version.txt") | |
echo "GitBuildVersionSimple=$version" >> $GITHUB_ENV | |
- name: Create Directory for Channel | |
run: mkdir ${{ github.workspace }}/${{ matrix.ChannelName }} | |
- run: dotnet publish './src/PresenceLight.Web/PresenceLight.Web.csproj' -r ${{ matrix.RID }} -c ${{ env.BuildConfiguration }} /p:PublishSingleFile=true -o ${{ github.workspace }}/PresenceLight.${{ env.GitBuildVersionSimple }}_${{ matrix.ChannelName }} /p:Version=${{ env.GitBuildVersionSimple }} | |
name: dotnet publish ${{ matrix.RID }} | |
if: ${{ success() }} | |
- name: Zip PresenceLight Web Files | |
run: | | |
Compress-Archive -Path '${{ github.workspace }}/PresenceLight.${{ env.GitBuildVersionSimple }}_${{ matrix.ChannelName }}' ` | |
-DestinationPath ${{ github.workspace }}/${{ matrix.ChannelName }}/PresenceLight.${{ matrix.ChannelName }}.${{ env.GitBuildVersionSimple }}.zip | |
shell: pwsh | |
- name: Publish Arifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
path: ${{ github.workspace }}/${{ matrix.ChannelName }} | |
name: ${{ matrix.ChannelName }} | |
Code_Signing: | |
needs: Build_Web | |
strategy: | |
matrix: | |
target: [ Windows_x64_x86, Windows_ARM, macOS, Linux_ARM, Linux_ARM64, Linux_Musl_x64, Linux_Musl_ARM_x64 ] | |
uses: isaacrlevin/presencelight/.github/workflows/Sign.yml@main | |
with: | |
target: ${{ matrix.target }} | |
# Code_Signing: | |
# uses: | |
# permissions: | |
# id-token: write # Required for requesting the JWT | |
# environment: | |
# name: Code_Signing | |
# url: ${{ steps.deploy_staging.outputs.webapp-url }} | |
# name: Code Sign Web | |
# runs-on: windows-latest | |
# strategy: | |
# matrix: | |
# include: | |
# - ChannelName: Windows_x64_x86 | |
# - ChannelName: Windows_ARM | |
# - ChannelName: macOS | |
# - ChannelName: Linux_ARM | |
# - ChannelName: Linux_ARM64 | |
# - ChannelName: Linux_Musl_x64 | |
# - ChannelName: Linux_Musl_ARM_x64 | |
# steps: | |
# - name: Download ${{ matrix.ChannelName }} Artifacts | |
# uses: actions/download-artifact@v4.1.0 | |
# with: | |
# name: ${{ matrix.ChannelName }} | |
# path: ${{ github.workspace }}\ToSign\${{ matrix.ChannelName }} | |
# - uses: actions/download-artifact@v4.1.0 | |
# name: Download Signing Scripts Artifacts | |
# with: | |
# name: SigningScripts | |
# path: "${{ github.workspace }}/SigningScripts" | |
# - name: Setup .NET | |
# uses: actions/setup-dotnet@v3 | |
# with: | |
# dotnet-version: 6.x | |
# - name: Install Sign CLI tool | |
# run: dotnet tool install --tool-path . sign --version 0.9.0-beta.23063.3 | |
# - name: Azure Login | |
# uses: azure/login@v1 | |
# with: | |
# creds: ${{ secrets.AZURE_CREDENTIALS }} | |
# - name: Sign artifacts | |
# shell: pwsh | |
# run: > | |
# ./sign code azure-key-vault | |
# '**/*.{exe,zip}' | |
# --timestamp-url "http://timestamp.digicert.com" | |
# --base-directory "${{ github.workspace }}/ToSign" | |
# --file-list "${{ github.workspace }}/SigningScripts/filelist.txt" | |
# --publisher-name "Isaac Levin" | |
# --description "PresenceLight" | |
# --description-url "https://github.com/isaacrlevin/presencelight" | |
# --azure-key-vault-managed-identity true | |
# --azure-key-vault-url "${{ secrets.KEY_VAULT_URL }}" | |
# --azure-key-vault-certificate "${{ secrets.KEY_VAULT_CERTIFICATE_ID }}" | |
# --verbosity Trace | |
# - name: Publish Signed ${{ matrix.ChannelName }} Packages | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# path: ${{ github.workspace }}\ToSign\${{ matrix.ChannelName }} | |
# name: '${{ matrix.ChannelName }}_Signed' | |
Deploy_Azure_Blob: | |
needs: Code_Signing | |
if: ${{ github.event_name != 'pull_request' }} | |
environment: | |
name: Deploy_Azure_Blob | |
url: ${{ steps.deploy_staging.outputs.webapp-url }} | |
name: Deploy Web Website | |
runs-on: ubuntu-latest | |
steps: | |
- name: Azure Login | |
uses: azure/login@v1 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Download Windows_x64_x86 Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Windows_x64_x86 | |
path: ${{ github.workspace }}/Sign/Windows_x64_x86 | |
- name: Download Windows_ARM Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Windows_ARM_Signed | |
path: ${{ github.workspace }}/Sign/Windows_ARM | |
- name: Download macOS Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: macOS_Signed | |
path: ${{ github.workspace }}/Sign/macOS | |
- name: Download Linux_ARM Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Linux_ARM_Signed | |
path: ${{ github.workspace }}/Sign/Linux_ARM | |
- name: Download Linux_ARM64 Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Linux_ARM64_Signed | |
path: ${{ github.workspace }}/Sign/Linux_ARM64 | |
- name: Download Linux_Musl_x64 Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Linux_Musl_x64_Signed | |
path: ${{ github.workspace }}/Sign/Linux_Musl_x64 | |
- name: Download Linux_Musl_ARM_x64 Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Linux_Musl_ARM_x64_Signed | |
path: ${{ github.workspace }}/Sign/Linux_Musl_ARM_x64 | |
- name: Archive Previous Release | |
uses: azure/cli@v1.0.0 | |
with: | |
inlineScript: | | |
az storage blob copy start-batch \ | |
--account-key ${{ secrets.ACCOUNT_KEY }} \ | |
--account-name ${{ secrets.ACCOUNT_NAME }} \ | |
--destination-container ${{ secrets.WORKER_ARCHIVE_CONTAINER }} \ | |
--source-account-key ${{ secrets.ACCOUNT_KEY }} \ | |
--source-account-name ${{ secrets.ACCOUNT_NAME }} \ | |
--source-container ${{ secrets.WORKER_CONTAINER }} | |
az storage blob delete-batch \ | |
--account-key ${{ secrets.ACCOUNT_KEY }} \ | |
--account-name ${{ secrets.ACCOUNT_NAME }} \ | |
--source ${{ secrets.WORKER_CONTAINER }} | |
azcliversion: latest | |
- name: Upload Release to Blob Storage | |
uses: bacongobbler/azure-blob-storage-upload@v1.2.0 | |
with: | |
source_dir: ${{ github.workspace }}/Sign | |
container_name: ${{ secrets.WORKER_CONTAINER }} | |
connection_string: ${{ secrets.AZUREBLOBCONNECTIONSTRING }} | |
sync: true | |
Deploy_Containers: | |
needs: Build_Web | |
if: ${{ github.event_name != 'pull_request' }} | |
environment: | |
name: Deploy_Containers | |
url: ${{ steps.deploy_staging.outputs.webapp-url }} | |
name: Deploy Web Containers (DockerHub / GitHub Packages) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download PreBuild | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: PreBuild | |
path: ${{ github.workspace }}/src | |
- uses: actions/download-artifact@v4.1.0 | |
name: Download Signing Scripts Artifacts | |
with: | |
name: SigningScripts | |
path: "${{ github.workspace }}/SigningScripts" | |
- name: Get Version from File | |
run: | | |
version=$(<"${{ github.workspace }}/SigningScripts/version.txt") | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Update Docker Files | |
run: | | |
$dockerFileLatest = Get-Content -path "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile" -Raw | |
$dockerFileLatest = $dockerFileLatest -replace '{VERSION}', "${{ env.VERSION }} " | |
$dockerFileLatest | Set-Content -Path "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile" | |
$dockerFile32 = Get-Content -path "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm32" -Raw | |
$dockerFile32 = $dockerFile32 -replace '{VERSION}', "${{ env.VERSION }} " | |
$dockerFile32 | Set-Content -Path "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm32" | |
$dockerFile64 = Get-Content -path "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm64" -Raw | |
$dockerFile64 = $dockerFile64 -replace '{VERSION}', "${{ env.VERSION }} " | |
$dockerFile64 | Set-Content -Path "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm64" | |
shell: pwsh | |
if: ${{ success() && github.event_name != 'pull_request' }} | |
- name: Push latest to GitHub | |
uses: opspresso/action-docker@master | |
with: | |
args: --docker | |
env: | |
USERNAME: isaacrlevin | |
REGISTRY: "ghcr.io" | |
PASSWORD: ${{ secrets.GH_PERSONAL_TOKEN }} | |
DOCKERFILE: "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile" | |
IMAGE_NAME: "isaacrlevin/presencelight" | |
TAG_NAME: "${{ env.VERSION }}" | |
LATEST: "true" | |
BUILD_PATH: "${{ github.workspace }}/src/" | |
- name: Push ARM to GitHub | |
uses: opspresso/action-docker@master | |
with: | |
args: --docker | |
env: | |
USERNAME: isaacrlevin | |
REGISTRY: "ghcr.io" | |
PASSWORD: ${{ secrets.GH_PERSONAL_TOKEN }} | |
DOCKERFILE: "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm32" | |
IMAGE_NAME: "isaacrlevin/presencelight" | |
TAG_NAME: "debian-arm32" | |
BUILD_PATH: "${{ github.workspace }}/src/" | |
- name: Push ARM64 to GitHub | |
uses: opspresso/action-docker@master | |
with: | |
args: --docker | |
env: | |
USERNAME: isaacrlevin | |
REGISTRY: "ghcr.io" | |
PASSWORD: ${{ secrets.GH_PERSONAL_TOKEN }} | |
DOCKERFILE: "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm64" | |
IMAGE_NAME: "isaacrlevin/presencelight" | |
TAG_NAME: "debian-arm64" | |
BUILD_PATH: "${{ github.workspace }}/src/" | |
- name: Push ARM to DockerHub (Versioned) | |
uses: opspresso/action-docker@master | |
with: | |
args: --docker | |
env: | |
USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKERFILE: "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm32" | |
IMAGE_NAME: "isaaclevin/presencelight" | |
TAG_NAME: "${{ env.VERSION }}-debian-arm32" | |
BUILD_PATH: "${{ github.workspace }}/src/" | |
- name: Push ARM to DockerHub (Latest) | |
uses: opspresso/action-docker@master | |
with: | |
args: --docker | |
env: | |
USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKERFILE: "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm32" | |
IMAGE_NAME: "isaaclevin/presencelight" | |
TAG_NAME: "debian-arm32" | |
BUILD_PATH: "${{ github.workspace }}/src/" | |
- name: Push ARM64 to DockerHub (Versioned) | |
uses: opspresso/action-docker@master | |
with: | |
args: --docker | |
env: | |
USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKERFILE: "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm64" | |
IMAGE_NAME: "isaaclevin/presencelight" | |
TAG_NAME: "${{ env.VERSION }}-debian-arm64" | |
BUILD_PATH: "${{ github.workspace }}/src/" | |
- name: Push ARM64 to DockerHub (Latest) | |
uses: opspresso/action-docker@master | |
with: | |
args: --docker | |
env: | |
USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKERFILE: "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile.debian-arm64" | |
IMAGE_NAME: "isaaclevin/presencelight" | |
TAG_NAME: "debian-arm64" | |
BUILD_PATH: "${{ github.workspace }}/src/" | |
- name: Push latest to DockerHub | |
uses: opspresso/action-docker@master | |
with: | |
args: --docker | |
env: | |
USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
DOCKERFILE: "${{ github.workspace }}/src/PresenceLight.Web/Dockerfile" | |
IMAGE_NAME: "isaaclevin/presencelight" | |
TAG_NAME: "${{ env.VERSION }}" | |
LATEST: "true" | |
BUILD_PATH: "${{ github.workspace }}/src/" | |
Deploy_GitHub_Release: | |
needs: Deploy_Azure_Blob | |
if: ${{ github.event_name != 'pull_request' }} | |
environment: | |
name: Deploy_GitHub_Release | |
url: ${{ steps.deploy_staging.outputs.webapp-url }} | |
name: Deploy Web GitHub Release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Generate changelog | |
id: changelog | |
uses: jaywcjlove/changelog-generator@main | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
filter: '' | |
env: | |
commitMode: true | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Download Windows_x64_x86 Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Windows_x64_x86 | |
path: ${{ github.workspace }}/Sign/Windows_x64_x86 | |
- name: Download Windows_ARM Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Windows_ARM | |
path: ${{ github.workspace }}/Sign/Windows_ARM | |
- name: Download macOS Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: macOS | |
path: ${{ github.workspace }}/Sign/macOS | |
- name: Download Linux_ARM Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Linux_ARM | |
path: ${{ github.workspace }}/Sign/Linux_ARM | |
- name: Download Linux_ARM64 Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Linux_ARM64 | |
path: ${{ github.workspace }}/Sign/Linux_ARM64 | |
- name: Download Linux_Musl_x64 Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Linux_Musl_x64 | |
path: ${{ github.workspace }}/Sign/Linux_Musl_x64 | |
- name: Download Linux_Musl_ARM_x64 Artifacts | |
uses: actions/download-artifact@v4.1.0 | |
with: | |
name: Linux_Musl_ARM_x64 | |
path: ${{ github.workspace }}/Sign/Linux_Musl_ARM_x64 | |
- uses: actions/download-artifact@v4.1.0 | |
name: Download Signing Scripts Artifacts | |
with: | |
name: SigningScripts | |
path: "${{ github.workspace }}/SigningScripts" | |
- name: Get Version from File | |
run: | | |
version=$(<"${{ github.workspace }}/SigningScripts/version.txt") | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
with: | |
tag_name: "Web-v${{ env.VERSION }}" | |
body: ${{ steps.changelog.outputs.changelog }} | |
fail_on_unmatched_files: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: | | |
${{ github.workspace }}/Sign/**/*.zip | |
- name: Setup tmate session | |
if: ${{ failure() }} | |
uses: mxschmitt/action-tmate@v3 |