update workflow #625
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/Web_Build.yml' | ||
- '.github/workflows/Test_WinGet.yml' | ||
- 'src/PresenceLight.Web/**' | ||
- 'src/DockerFiles/**' | ||
- '*.md' | ||
pull_request: | ||
branches: [ main ] | ||
paths-ignore: | ||
- '.github/workflows/Web_Build.yml' | ||
- '.github/workflows/Sign.yml' | ||
- 'src/PresenceLight.Web/**' | ||
- 'src/DockerFiles/**' | ||
- '*.md' | ||
jobs: | ||
Build_WPF: | ||
name: Build WPF | ||
runs-on: windows-latest | ||
strategy: | ||
matrix: | ||
ChannelName: | ||
- Release | ||
- Nightly | ||
- Standalone | ||
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/Desktop- | ||
Win10RID: net8.0-windows10.0.19041 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
- name: setup-msbuild | ||
uses: microsoft/setup-msbuild@v1 | ||
- name: Use .NET Core SDK 8.0.x | ||
uses: actions/setup-dotnet@v1 | ||
with: | ||
dotnet-version: 8.0.x | ||
include-prerelease: true | ||
- name: Nerdbank.GitVersioning | ||
uses: dotnet/nbgv@v0.3.1 | ||
with: | ||
setCommonVars: true | ||
- run: echo "BuildNumber - ${{ env.GitBuildVersionSimple }}" | ||
- name: Create Directory for Channel | ||
run: mkdir ${{ github.workspace }}\${{ matrix.ChannelName }} | ||
shell: powershell | ||
- name: Add Version File to Artifact | ||
run : | | ||
New-Item -Path ${{ github.workspace }}\.chocolatey -Name "version.txt" -ItemType "file" -Value "${{ env.GitBuildVersionSimple }}" | ||
New-Item -Path ${{ github.workspace }}\Build -Name "version.txt" -ItemType "file" -Value "${{ env.GitBuildVersionSimple }}" | ||
New-Item -Path ${{ github.workspace }}\${{ matrix.ChannelName }} -Name "version.txt" -ItemType "file" -Value "${{ env.GitBuildVersionSimple }}" | ||
shell: powershell | ||
- name: Update AppxManifest version | ||
run: | | ||
# Update appxmanifest. This must be done before build. | ||
[xml]$manifest= get-content ".\src\DesktopClient\PresenceLight.Package\Package.appxmanifest" | ||
$manifest.Package.Identity.Version = "${{ env.GitBuildVersionSimple }}.0" | ||
$manifest.save(".\src\DesktopClient\PresenceLight.Package\Package.appxmanifest") | ||
shell: powershell | ||
if: ${{ success() && matrix.ChannelName == 'Release' }} | ||
- name: Update Nightly AppxManifest version | ||
run: | | ||
# Update appxmanifest. This must be done before build. | ||
[xml]$manifest = Get-Content ".\src\DesktopClient\PresenceLight.Package\Package-Nightly.appxmanifest" | ||
$manifest.Package.Identity.Version = "${{ env.GitBuildVersionSimple }}.0" | ||
$manifest.Save(".\src\DesktopClient\PresenceLight.Package\Package-Nightly.appxmanifest") | ||
shell: powershell | ||
if: ${{ success() && matrix.ChannelName == 'Nightly' }} | ||
- name: Update appsettings.json for Standalone Version | ||
run: | | ||
# Update AppSettings.json. This must be done before build. | ||
$appsettings= get-content ".\src\DesktopClient\PresenceLight\appsettings.json" -raw | ConvertFrom-Json | ||
$appsettings.isAppPackaged = "false" | ||
$appsettings | ConvertTo-Json -depth 32| set-content '.\src\DesktopClient\PresenceLight\appsettings.json' | ||
shell: powershell | ||
if: ${{ success() && matrix.ChannelName == 'Standalone' }} | ||
- name: Update appsettings.json for AppPackage Version | ||
run: | | ||
# Update AppSettings.json. This must be done before build. | ||
$appsettings= get-content ".\src\DesktopClient\PresenceLight\appsettings.json" -raw | ConvertFrom-Json | ||
$appsettings.isAppPackaged = "true" | ||
$appsettings | ConvertTo-Json -depth 32| set-content '.\src\DesktopClient\PresenceLight\appsettings.json' | ||
shell: powershell | ||
if: ${{ success() && matrix.ChannelName != 'Standalone' }} | ||
- name: Add Secrets to appsettings.json | ||
run: | | ||
# Update AppSettings.json. This must be done before build. | ||
$appsettings= get-content ".\src\DesktopClient\PresenceLight\appsettings.json" -raw | ConvertFrom-Json | ||
$appsettings.aadSettings.clientId = "${{ secrets.ApplicationId }}" | ||
$appsettings.appVersion = "${{ env.GitBuildVersionSimple }}" | ||
$appsettings.lightSettings.lifx.LIFXClientId = "${{ secrets.LIFXClientId }}" | ||
$appsettings.lightSettings.lifx.LIFXClientSecret = "${{ secrets.LIFXClientSecret }}" | ||
$appsettings.applicationInsights.instrumentationkey = "${{ secrets.InstrumentationKey }}" | ||
$appsettings.lightSettings.hue.RemoteHueClientId = "${{ secrets.RemoteHueClientId }}" | ||
$appsettings.lightSettings.hue.RemoteHueClientSecret = "${{ secrets.RemoteHueClientSecret }}" | ||
$appsettings.lightSettings.hue.RemoteHueClientAppName = "${{ secrets.RemoteHueClientAppName }}" | ||
$appsettings | ConvertTo-Json -depth 32| set-content '.\src\DesktopClient\PresenceLight\appsettings.json' | ||
shell: powershell | ||
if: ${{ success() && github.event_name != 'pull_request' }} | ||
- name: Update Badge Versions | ||
run: | | ||
# Update badges | ||
[xml]$badge = Get-Content ".\Build\ci_badge.svg" | ||
$badge.svg.g[1].text[2].InnerText = "${{ env.GitBuildVersionSimple }}.0" | ||
$badge.svg.g[1].text[3].InnerText = "${{ env.GitBuildVersionSimple }}.0" | ||
$badge.Save("${{ github.workspace }}\${{ matrix.ChannelName }}\ci_badge.svg") | ||
[xml]$badge = Get-Content ".\Build\store_badge.svg" | ||
$badge.svg.g[1].text[2].InnerText = "${{ env.GitBuildVersionSimple }}.0" | ||
$badge.svg.g[1].text[3].InnerText = "${{ env.GitBuildVersionSimple }}.0" | ||
$badge.Save("${{ github.workspace }}\${{ matrix.ChannelName }}\stable_badge.svg") | ||
shell: powershell | ||
- name: Build Standalone Presence Light x86 | ||
run: | | ||
dotnet restore .\src\DesktopClient\PresenceLight\PresenceLight.csproj | ||
dotnet publish .\src\DesktopClient\PresenceLight\PresenceLight.csproj -c ${{ env.BuildConfiguration }} /p:PublishProfile=Properties/PublishProfiles/WinX86.pubxml | ||
if: ${{ success() && matrix.ChannelName == 'Standalone' }} | ||
- name: Build Standalone Presence Light x64 | ||
run: | | ||
dotnet restore .\src\DesktopClient\PresenceLight\PresenceLight.csproj | ||
dotnet publish .\src\DesktopClient\PresenceLight\PresenceLight.csproj -c ${{ env.BuildConfiguration }} /p:PublishProfile=Properties/PublishProfiles/WinX64.pubxml | ||
if: ${{ success() && matrix.ChannelName == 'Standalone' }} | ||
- name: Build Standalone Presence Light ARM64 | ||
run: | | ||
dotnet restore .\src\DesktopClient\PresenceLight\PresenceLight.csproj | ||
dotnet publish .\src\DesktopClient\PresenceLight\PresenceLight.csproj -c ${{ env.BuildConfiguration }} /p:PublishProfile=Properties/PublishProfiles/WinARM64.pubxml | ||
if: ${{ success() && matrix.ChannelName == 'Standalone' }} | ||
- name: Zip Standalone PresenceLight x86 Files | ||
run: | | ||
Compress-Archive -Path '.\src\DesktopClient\PresenceLight\bin\${{ env.BuildConfiguration }}\${{ env.Win10RID }}\win-x86\publish\*' ` | ||
-DestinationPath ${{ github.workspace }}\${{ matrix.ChannelName }}\PresenceLight.${{ env.GitBuildVersionSimple }}-x86.zip | ||
shell: powershell | ||
if: ${{ success() && matrix.ChannelName == 'Standalone' }} | ||
- name: Zip Standalone PresenceLight x64 Files | ||
run: | | ||
Compress-Archive -Path '.\src\DesktopClient\PresenceLight\bin\${{ env.BuildConfiguration }}\${{ env.Win10RID }}\win-x64\publish\*' ` | ||
-DestinationPath ${{ github.workspace }}\${{ matrix.ChannelName }}\PresenceLight.${{ env.GitBuildVersionSimple }}-x64.zip | ||
shell: powershell | ||
if: ${{ success() && matrix.ChannelName == 'Standalone' }} | ||
- name: Zip Standalone PresenceLight ARM Files | ||
run: | | ||
Compress-Archive -Path '.\src\DesktopClient\PresenceLight\bin\${{ env.BuildConfiguration }}\${{ env.Win10RID }}\win-arm64\publish\*' ` | ||
-DestinationPath ${{ github.workspace }}\${{ matrix.ChannelName }}\PresenceLight.${{ env.GitBuildVersionSimple }}-win-arm64.zip | ||
shell: powershell | ||
if: ${{ success() && matrix.ChannelName == 'Standalone' }} | ||
- name: Build Appx Package | ||
run: | | ||
#dotnet restore .\src\DesktopClient\PresenceLight\PresenceLight.csproj | ||
#msbuild /t:restore .\src\DesktopClient\PresenceLight.Package\PresenceLight.Package.wapproj | ||
msbuild '.\src\DesktopClient\PresenceLight.Package\PresenceLight.Package.wapproj' /p:VersionNumber=${{ env.GitBuildVersionSimple }} ` | ||
/p:ChannelName=${{ matrix.ChannelName }} /p:configuration='${{ env.BuildConfiguration }}' /p:IncludeSymbols=true ` | ||
/p:AppxPackageDir="${{ github.workspace }}\${{ matrix.ChannelName }}\\" | ||
if: ${{ success() && matrix.ChannelName != 'Standalone' }} | ||
- name: Publish ${{ matrix.ChannelName }} Arifacts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: ${{ github.workspace }}\${{ matrix.ChannelName }} | ||
name: ${{ matrix.ChannelName }} | ||
- name: Publish signing scripts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: Build | ||
name: SigningScripts | ||
if: ${{ success() && matrix.ChannelName == 'Release' }} | ||
- name: Publish .chocolatey scripts | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: .chocolatey | ||
name: Chocolatey | ||
if: ${{ success() && matrix.ChannelName == 'Standalone' }} | ||
Code_Signing: | ||
needs: Build_WPF | ||
if: ${{ (github.event_name != 'pull_request') && (github.ref == 'refs/heads/main') }} | ||
permissions: | ||
id-token: write # Required for requesting the JWT | ||
environment: | ||
name: Code_Signing | ||
url: ${{ steps.deploy_staging.outputs.webapp-url }} | ||
name: Code Sign WPF | ||
runs-on: windows-latest | ||
steps: | ||
- name: Azure Login | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
- name: Download Artifacts | ||
uses: actions/download-artifact@v2 | ||
with: | ||
path: ${{ github.workspace }}\ToSign | ||
- uses: actions/download-artifact@v2 | ||
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 Nightly | ||
shell: pwsh | ||
run: > | ||
./sign code azure-key-vault | ||
**/*.appxbundle | ||
--timestamp-url "http://timestamp.digicert.com" | ||
--base-directory "${{ github.workspace }}\ToSign\Nightly" | ||
--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: Sign Release | ||
shell: pwsh | ||
run: > | ||
./sign code azure-key-vault | ||
**/*.appxbundle | ||
--timestamp-url "http://timestamp.digicert.com" | ||
--base-directory "${{ github.workspace }}\ToSign\Release" | ||
--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: Sign AppInstaller | ||
shell: pwsh | ||
run: > | ||
./sign code azure-key-vault | ||
**/*.appinstaller | ||
--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: Sign Zip | ||
shell: pwsh | ||
run: > | ||
./sign code azure-key-vault | ||
**/*.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 Release Packages | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: ${{ github.workspace }}\ToSign\Release | ||
name: ReleaseSigned | ||
- name: Publish Signed Nightly Packages | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: ${{ github.workspace }}\ToSign\Nightly | ||
name: NightlySigned | ||
- name: Publish Signed Standalone Packages | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
path: ${{ github.workspace }}\ToSign\Standalone | ||
name: StandaloneSigned | ||
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 WPF Nightly | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Azure Login | ||
uses: azure/login@v1 | ||
with: | ||
creds: ${{ secrets.AZURE_CREDENTIALS }} | ||
- uses: actions/download-artifact@v2 | ||
name: Download Nightly Signed | ||
with: | ||
name: NightlySigned | ||
path: "${{ github.workspace }}/NightlySigned" | ||
- name: Copy files to same directory | ||
run: | | ||
Copy-Item "${{ github.workspace }}/NightlySigned" -Destination "${{ github.workspace }}/Upload" -Recurse -Verbose | ||
dir .\Upload\ | ||
az storage blob upload --account-key ${{ secrets.ACCOUNT_KEY }} --account-name ${{ secrets.ACCOUNT_NAME }} -f /home/runner/work/presencelight/presencelight/Upload/ci_badge.svg -n ci_badge.svg -c nightly --content-type image/svg+xml --debug --overwrite | ||
az storage blob upload --account-key ${{ secrets.ACCOUNT_KEY }} --account-name ${{ secrets.ACCOUNT_NAME }} -f /home/runner/work/presencelight/presencelight/Upload/PresenceLight.Package.appinstaller -n PresenceLight.Package.appinstaller -c nightly --content-type application/xml --debug --overwrite | ||
az storage blob upload-batch --account-key ${{ secrets.ACCOUNT_KEY }} --account-name ${{ secrets.ACCOUNT_NAME }} --source /home/runner/work/presencelight/presencelight/Upload --pattern *.appxbundle -d nightly --content-type application/vns.ms-appx --debug | ||
shell: pwsh | ||
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 WPF GitHub Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
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 }} | ||
- uses: actions/download-artifact@v2 | ||
name: Download Nightly Signed | ||
with: | ||
name: StandaloneSigned | ||
path: "${{ github.workspace }}/StandaloneSigned" | ||
- uses: actions/download-artifact@v2 | ||
name: Download Release Signed | ||
with: | ||
name: ReleaseSigned | ||
path: "${{ github.workspace }}/ReleaseSigned" | ||
- name: Get Version from File | ||
run: | | ||
version=$(<"${{ github.workspace }}/StandaloneSigned/version.txt") | ||
echo "VERSION=$version" >> $GITHUB_ENV | ||
- name: Add hashes | ||
run: | | ||
$zip64Hash = Get-FileHash "/home/runner/work/presencelight/presencelight/StandaloneSigned/PresenceLight.${{ env.VERSION }}-x64.zip" -Algorithm SHA256 | ||
$zip64Hash.Hash | Out-File -Encoding 'UTF8' "/home/runner/work/presencelight/presencelight/StandaloneSigned/x64-zip.sha256" | ||
$zip86Hash = Get-FileHash "/home/runner/work/presencelight/presencelight/StandaloneSigned/PresenceLight.${{ env.VERSION }}-x86.zip" -Algorithm SHA256 | ||
$zip86Hash.Hash | Out-File -Encoding 'UTF8' "/home/runner/work/presencelight/presencelight/StandaloneSigned/x86-zip.sha256" | ||
$zipARMHash = Get-FileHash "/home/runner/work/presencelight/presencelight/StandaloneSigned/PresenceLight.${{ env.VERSION }}-win-arm64.zip" -Algorithm SHA256 | ||
$zipARMHash.Hash | Out-File -Encoding 'UTF8' "/home/runner/work/presencelight/presencelight/StandaloneSigned/win-arm64-zip.sha256" | ||
$appxHash = Get-FileHash "/home/runner/work/presencelight/presencelight/ReleaseSigned/PresenceLight.Package_${{ env.VERSION }}.0_Test/PresenceLight.Package_${{ env.VERSION }}.0_x64_x86_ARM64.appxbundle" -Algorithm SHA256 | ||
$appxHash.Hash | Out-File -Encoding 'UTF8' "/home/runner/work/presencelight/presencelight/ReleaseSigned/appx.sha256" | ||
shell: pwsh | ||
- name: Create GitHub Release | ||
uses: meeDamian/github-release@2.0 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
tag: "Desktop-v${{ env.VERSION }}" | ||
name: "Desktop v${{ env.VERSION }}" | ||
body: > | ||
${{ steps.changelog.outputs.compareurl }} | ||
${{ steps.changelog.outputs.changelog }} | ||
gzip: folders | ||
files: > | ||
"/home/runner/work/presencelight/presencelight/StandaloneSigned/PresenceLight.${{ env.VERSION }}-x86.zip" | ||
"/home/runner/work/presencelight/presencelight/StandaloneSigned/x86-zip.sha256" | ||
"/home/runner/work/presencelight/presencelight/StandaloneSigned/PresenceLight.${{ env.VERSION }}-x64.zip" | ||
"/home/runner/work/presencelight/presencelight/StandaloneSigned/x64-zip.sha256" | ||
"/home/runner/work/presencelight/presencelight/StandaloneSigned/PresenceLight.${{ env.VERSION }}-win-arm64.zip" | ||
"/home/runner/work/presencelight/presencelight/StandaloneSigned/win-arm64-zip.sha256" | ||
"/home/runner/work/presencelight/presencelight/ReleaseSigned/appx.sha256" | ||
"/home/runner/work/presencelight/presencelight/ReleaseSigned/PresenceLight.Package_${{ env.VERSION }}.0_Test/PresenceLight.Package_${{ env.VERSION }}.0_x64_x86_ARM64.appxbundle" | ||
Deploy_Choco: | ||
needs: Deploy_GitHub_Release | ||
if: ${{ github.event_name != 'pull_request' }} | ||
uses: isaacrlevin/presencelight/.github/workflows/Choco.yml@main | ||
Check failure on line 440 in .github/workflows/Desktop_Build.yml GitHub Actions / .github/workflows/Desktop_Build.ymlInvalid workflow file
|
||
with: | ||
Version: ${{ env.VERSION }} |