Add Choco shared workflow #623
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 | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "Desktop-v${{ env.VERSION }}" | |
release_name: "Desktop v${{ env.VERSION }}" | |
body: | | |
${{ steps.changelog.outputs.compareurl }} | |
${{ steps.changelog.outputs.changelog }} | |
draft: false | |
prerelease: false | |
- name: Upload Standalone x86 Release | |
id: upload-release-asset4 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "/home/runner/work/presencelight/presencelight/StandaloneSigned/PresenceLight.${{ env.VERSION }}-x86.zip" | |
asset_name: "PresenceLight.${{ env.VERSION }}-x86.zip" | |
asset_content_type: application/zip | |
- name: Upload x86 Hash | |
id: upload-release-asset5 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "/home/runner/work/presencelight/presencelight/StandaloneSigned/x86-zip.sha256" | |
asset_name: "x86-zip.sha256" | |
asset_content_type: text/plain | |
- name: Upload Standalone x64 Release | |
id: upload-release-asset1 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "/home/runner/work/presencelight/presencelight/StandaloneSigned/PresenceLight.${{ env.VERSION }}-x64.zip" | |
asset_name: "PresenceLight.${{ env.VERSION }}-x64.zip" | |
asset_content_type: application/zip | |
- name: Upload x64 Hash | |
id: upload-release-asset6 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "/home/runner/work/presencelight/presencelight/StandaloneSigned/x64-zip.sha256" | |
asset_name: "x64-zip.sha256" | |
asset_content_type: text/plain | |
- name: Upload Standalone ARM Release | |
id: upload-release-asset2 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "/home/runner/work/presencelight/presencelight/StandaloneSigned/PresenceLight.${{ env.VERSION }}-win-arm64.zip" | |
asset_name: "PresenceLight.${{ env.VERSION }}-win-arm64.zip" | |
asset_content_type: application/zip | |
- name: Upload ARM Hash | |
id: upload-release-asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "/home/runner/work/presencelight/presencelight/StandaloneSigned/win-arm64-zip.sha256" | |
asset_name: "win-arm64-zip.sha256" | |
asset_content_type: text/plain | |
- name: Upload APPX | |
id: upload-release-asset7 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "/home/runner/work/presencelight/presencelight/ReleaseSigned/PresenceLight.Package_${{ env.VERSION }}.0_Test/PresenceLight.Package_${{ env.VERSION }}.0_x64_x86_ARM64.appxbundle" | |
asset_name: "PresenceLight.Package_${{ env.VERSION }}.0_x64_x86_ARM64.appxbundle" | |
asset_content_type: application/zip | |
- name: Upload APPX Hash | |
id: upload-release-asset8 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: "/home/runner/work/presencelight/presencelight/ReleaseSigned/appx.sha256" | |
asset_name: "appx.sha256" | |
asset_content_type: text/plain | |
Deploy_Choco: | |
needs: Deploy_GitHub_Release | |
if: ${{ github.event_name != 'pull_request' }} | |
environment: | |
name: Deploy_Choco | |
url: ${{ steps.deploy_staging.outputs.webapp-url }} | |
name: Deploy WPF Chocolatey | |
runs-on: windows-latest | |
env: | |
GitHubReleaseUrl: https://github.com/isaacrlevin/presencelight/releases/download/Desktop- | |
steps: | |
- uses: actions/download-artifact@v2 | |
name: Download Nightly Signed | |
with: | |
name: StandaloneSigned | |
path: "${{ github.workspace }}\\StandaloneSigned" | |
- uses: actions/download-artifact@v2 | |
name: Download Chocolatey Artifacts | |
with: | |
name: Chocolatey | |
path: "${{ github.workspace }}\\Chocolatey" | |
- name: Get Version from File | |
run: | | |
version=$(<"${{ github.workspace }}\\Chocolatey\\version.txt") | |
echo "VERSION=$version" >> $GITHUB_ENV | |
shell: bash | |
- name: Update Chocolatey Files | |
run: | | |
# Hash the Zip Files | |
mkdir "${{ github.workspace }}\Download" | |
Invoke-WebRequest -Uri "${{ env.GitHubReleaseUrl }}v${{ env.VERSION }}/x86-zip.sha256" -OutFile "${{ github.workspace }}\\Download\\x86-zip.sha256" | |
Invoke-WebRequest -Uri "${{ env.GitHubReleaseUrl }}v${{ env.VERSION }}/x64-zip.sha256" -OutFile "${{ github.workspace }}\\Download\\x64-zip.sha256" | |
Invoke-WebRequest -Uri "${{ env.GitHubReleaseUrl }}v${{ env.VERSION }}/win-arm64-zip.sha256" -OutFile "${{ github.workspace }}\\Download\\win-arm64-zip.sha256" | |
$hash86= get-content ${{ github.workspace }}\\Download\\x86-zip.sha256 | |
$hash64= get-content ${{ github.workspace }}\\Download\\x64-zip.sha256 | |
$hashARM= get-content ${{ github.workspace }}\\Download\\win-arm64-zip.sha256 | |
# Update ChocolateyInstall.ps1 | |
$installFile = Get-Content -path "${{ github.workspace }}\\Chocolatey\\tools\\ChocolateyInstall.ps1" -Raw | |
$installFile = $installFile -replace '{ReplaceCheckSumARM}', $hashARM | |
$installFile = $installFile -replace '{ReplaceCheckSumx86}', $hash86 | |
$installFile = $installFile -replace '{ReplaceCheckSumx64}', $hash64 | |
$installFile = $installFile -replace '{ARMLink}' , "${{ env.GitHubReleaseUrl }}v${{ env.VERSION }}/PresenceLight.${{ env.VERSION }}-win-arm64.zip" | |
$installFile = $installFile -replace '{x86Link}' , "${{ env.GitHubReleaseUrl }}v${{ env.VERSION }}/PresenceLight.${{ env.VERSION }}-x86.zip" | |
$installFile = $installFile -replace '{x64Link}' , "${{ env.GitHubReleaseUrl }}v${{ env.VERSION }}/PresenceLight.${{ env.VERSION }}-x64.zip" | |
$installFile | Set-Content -Path "${{ github.workspace }}\\Chocolatey\\tools\\ChocolateyInstall.ps1" | |
# Update Verification.txt | |
$verificationFile = Get-Content -path "${{ github.workspace }}\\Chocolatey\\tools\\Verification.txt" | |
$verificationFile = $verificationFile -replace '{ARMLink}' , "${{ env.GitHubReleaseUrl }}v${{ env.VERSION }}/PresenceLight.${{ env.VERSION }}-win-arm64.zip" | |
$verificationFile = $verificationFile -replace '{x64Link}' , "${{ env.GitHubReleaseUrl }}v${{ env.VERSION }}/PresenceLight.${{ env.VERSION }}-x64.zip" | |
$verificationFile = $verificationFile -replace '{x86Link}' , "${{ env.GitHubReleaseUrl }}v${{ env.VERSION }}/PresenceLight.${{ env.VERSION }}-x86.zip" | |
$verificationFile = $verificationFile -replace '{HASHx64}', $hash64 | |
$verificationFile = $verificationFile -replace '{HASHx86}', $hash86 | |
$verificationFile = $verificationFile -replace '{HASHARM}', $hashARM | |
$verificationFile | Set-Content -Path "${{ github.workspace }}\\Chocolatey\\tools\\Verification.txt" | |
shell: powershell | |
- name: Push to Chocolatey | |
run: | | |
# Chocolatey Pack | |
& choco.exe pack "${{ github.workspace }}\\Chocolatey\\PresenceLight.nuspec" --version "${{ env.VERSION }}.0" --OutputDirectory "${{ github.workspace }}\\Chocolatey" | |
& choco.exe apikey --key "${{ secrets.CHOCOAPIKEY }}" --source https://push.chocolatey.org/ | |
$nupkgs = gci "${{ github.workspace }}\\Chocolatey\\PresenceLight.*.nupkg" | Select -ExpandProperty FullName | |
foreach ($nupkg in $nupkgs){ | |
& choco.exe push $nupkg --source https://push.chocolatey.org/ | |
} | |
shell: powershell | |
Deploy_Store: | |
needs: Deploy_Azure_Blob | |
if: ${{ github.event_name != 'pull_request' }} | |
environment: | |
name: Deploy_Store | |
url: ${{ steps.deploy_staging.outputs.webapp-url }} | |
name: Deploy WPF Windows Store | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v2 | |
name: Download Release Signed | |
with: | |
name: ReleaseSigned | |
path: "${{ github.workspace }}/ReleaseSigned" | |
- name: Copy files to same directory | |
run: | | |
az storage blob upload --account-key ${{ secrets.ACCOUNT_KEY }} --account-name ${{ secrets.ACCOUNT_NAME }} -f "${{ github.workspace }}/ReleaseSigned/stable_badge.svg" -n stable_badge.svg -c store --content-type image/svg+xml --debug --overwrite | |
shell: pwsh | |
- name: Windows Store Publish | |
uses: isaacrlevin/windows-store-action@1.0 | |
with: | |
tenant-id: ${{ secrets.STORE_TENANT }} | |
client-id: ${{ secrets.STORE_CLIENT_ID }} | |
client-secret: ${{ secrets.STORE_CLIENT_SECRET }} | |
app-id: ${{ secrets.APP_ID }} | |
package-path: "${{ github.workspace }}/ReleaseSigned/" | |
Deploy_WinGet: | |
needs: Deploy_GitHub_Release | |
if: ${{ github.event_name != 'pull_request' }} | |
environment: | |
name: Deploy_WinGet | |
url: ${{ steps.deploy_staging.outputs.webapp-url }} | |
name: Deploy WinGet | |
runs-on: windows-latest | |
env: | |
GitHubReleaseUrl: https://github.com/isaacrlevin/presencelight/releases/download/Desktop- | |
steps: | |
- uses: actions/download-artifact@v2 | |
name: Download Chocolatey Artifacts | |
with: | |
name: Chocolatey | |
path: "${{ github.workspace }}\\Chocolatey" | |
- name: Get Version from File | |
run: | | |
version=$(<"${{ github.workspace }}\\Chocolatey\\version.txt") | |
echo "VERSION=$version" >> $GITHUB_ENV | |
shell: bash | |
- uses: actions/download-artifact@v2 | |
name: Download Signing Scripts Artifacts | |
with: | |
name: SigningScripts | |
path: "${{ github.workspace }}/SigningScripts" | |
- name: Create manifest and submit PR | |
working-directory: ${{ github.workspace }}/SigningScripts/winget | |
run: | | |
./build.ps1 -Version "${{ env.VERSION }}" -Token "${{ secrets.WINGETCREATE_TOKEN }}" |