From 918998ba98c2f013670ac1baef4f7a0c035782a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 09:32:57 +0200 Subject: [PATCH 01/13] Build the appx --- .github/workflows/deploy.yml | 91 +++++++++++++++++++ ...roductivity.SnippetManager.Package.wapproj | 3 +- .../Package.appxmanifest | 2 +- 3 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..3d3d1c2 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,91 @@ +name: Build and Deploy + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: # Allow manual trigger + +env: + SOLUTION_FILE_PATH: ./Neptuo.Productivity.SnippetManager.sln + BUILD_CONFIGURATION: Release + BUILD_PLATFORM: x86 + APPX_PACKAGE_DIR: ${{ github.workspace }}/AppPackages + +jobs: + build: + runs-on: windows-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '9.0.x' + + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v2 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v2 + + - name: Cache NuGet packages + uses: actions/cache@v4 + with: + path: ~/.nuget/packages + key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} + restore-keys: | + ${{ runner.os }}-nuget- + + - name: Restore dependencies + run: dotnet restore ${{ env.SOLUTION_FILE_PATH }} + + - name: Build solution + run: | + msbuild ${{ env.SOLUTION_FILE_PATH }} ` + /p:Configuration=${{ env.BUILD_CONFIGURATION }} ` + /p:Platform=${{ env.BUILD_PLATFORM }} ` + /p:AppxBundlePlatforms=${{ env.BUILD_PLATFORM }} ` + /p:AppxPackageDir=${{ env.APPX_PACKAGE_DIR }} ` + /p:AppxBundle=Always ` + /p:UapAppxPackageBuildMode=SideloadOnly ` + /p:AppxPackageSigningEnabled=false + + - name: List build output + run: | + Write-Host "Build output directory contents:" + Get-ChildItem -Recurse ${{ env.APPX_PACKAGE_DIR }} | Format-Table -AutoSize + + - name: Upload MSIX package artifacts + uses: actions/upload-artifact@v4 + with: + name: msix-package-${{ env.BUILD_PLATFORM }} + path: | + ${{ env.APPX_PACKAGE_DIR }}/**/*.msix + ${{ env.APPX_PACKAGE_DIR }}/**/*.msixbundle + ${{ env.APPX_PACKAGE_DIR }}/**/*.appxupload + retention-days: 30 + + - name: Upload App Installer artifacts + uses: actions/upload-artifact@v4 + if: always() + with: + name: app-installer-${{ env.BUILD_PLATFORM }} + path: | + ${{ env.APPX_PACKAGE_DIR }}/**/*.appinstaller + retention-days: 30 + + - name: Upload build logs + uses: actions/upload-artifact@v4 + if: failure() + with: + name: build-logs + path: | + **/*.log + **/*.binlog + retention-days: 7 diff --git a/src/Neptuo.Productivity.SnippetManager.Package/Neptuo.Productivity.SnippetManager.Package.wapproj b/src/Neptuo.Productivity.SnippetManager.Package/Neptuo.Productivity.SnippetManager.Package.wapproj index 1a62b6b..b5b2262 100644 --- a/src/Neptuo.Productivity.SnippetManager.Package/Neptuo.Productivity.SnippetManager.Package.wapproj +++ b/src/Neptuo.Productivity.SnippetManager.Package/Neptuo.Productivity.SnippetManager.Package.wapproj @@ -62,10 +62,9 @@ False True x86 - \\heap\Temp\SnippetManager + https://apps.neptuo.com/snippetmanager 0 E91A19A0E44C1DD0640117CBD55AAFA516E4D866 - \\heap\Temp\SnippetManager Always diff --git a/src/Neptuo.Productivity.SnippetManager.Package/Package.appxmanifest b/src/Neptuo.Productivity.SnippetManager.Package/Package.appxmanifest index c76fc5d..65cfa18 100644 --- a/src/Neptuo.Productivity.SnippetManager.Package/Package.appxmanifest +++ b/src/Neptuo.Productivity.SnippetManager.Package/Package.appxmanifest @@ -10,7 +10,7 @@ + Version="0.23.0.0" /> Snippet Manager by Neptuo From 7ce83d351be1aff99fe28f007819353e5cc753bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 09:40:03 +0200 Subject: [PATCH 02/13] Produce binlog. Restore for win-x86 --- .github/workflows/deploy.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3d3d1c2..248a824 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -43,11 +43,12 @@ jobs: ${{ runner.os }}-nuget- - name: Restore dependencies - run: dotnet restore ${{ env.SOLUTION_FILE_PATH }} + run: dotnet restore ${{ env.SOLUTION_FILE_PATH }} -r win-${{ env.BUILD_PLATFORM }} - name: Build solution run: | msbuild ${{ env.SOLUTION_FILE_PATH }} ` + /bl ` /p:Configuration=${{ env.BUILD_CONFIGURATION }} ` /p:Platform=${{ env.BUILD_PLATFORM }} ` /p:AppxBundlePlatforms=${{ env.BUILD_PLATFORM }} ` From 6e310ebad8a9ab9855f706d458de35ffff53efb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 09:47:46 +0200 Subject: [PATCH 03/13] Version from tag and appxmanifest update --- .github/workflows/deploy.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 248a824..7f5097c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -45,6 +45,29 @@ jobs: - name: Restore dependencies run: dotnet restore ${{ env.SOLUTION_FILE_PATH }} -r win-${{ env.BUILD_PLATFORM }} + - name: Extract version from tag + id: version + run: | + $version = "0.0.0" # Default version + if ($env:GITHUB_REF -like "refs/tags/v*") { + $version = $env:GITHUB_REF -replace "refs/tags/v", "" + Write-Host "Found tag version: $version" + } else { + Write-Host "No version tag found, using default: $version" + } + echo "number=$version" >> $env:GITHUB_OUTPUT + echo "appx=$version.0" >> $env:GITHUB_OUTPUT + + - name: Update Version in manifest + working-directory: './src/Neptuo.Productivity.SnippetManager.Package' + run: | + $xmlFilePath = "Package.appxmanifest" + [xml]$xml = Get-Content $xmlFilePath + $newVersion = "${{ steps.version.outputs.appx }}" + $xml.Package.Identity.Version = $newVersion + $xml.Save($xmlFilePath) + Write-Output "Version updated to $newVersion in $xmlFilePath" + - name: Build solution run: | msbuild ${{ env.SOLUTION_FILE_PATH }} ` From 0778527b9e1e10f422911eb8836f2a08949c118e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 09:52:55 +0200 Subject: [PATCH 04/13] Include HTML in the appinstaller bundle --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7f5097c..83df7fc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -102,6 +102,7 @@ jobs: name: app-installer-${{ env.BUILD_PLATFORM }} path: | ${{ env.APPX_PACKAGE_DIR }}/**/*.appinstaller + ${{ env.APPX_PACKAGE_DIR }}/**/*.html retention-days: 30 - name: Upload build logs From a2f45537752f30801451ac1875b6861355111cf7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 10:05:23 +0200 Subject: [PATCH 05/13] Deploy --- .github/workflows/deploy.yml | 82 ++++++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 9 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 83df7fc..de434ed 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,6 +3,7 @@ name: Build and Deploy on: push: branches: [ main ] + tags: [ 'v*' ] pull_request: branches: [ main ] workflow_dispatch: # Allow manual trigger @@ -85,25 +86,88 @@ jobs: Write-Host "Build output directory contents:" Get-ChildItem -Recurse ${{ env.APPX_PACKAGE_DIR }} | Format-Table -AutoSize - - name: Upload MSIX package artifacts - uses: actions/upload-artifact@v4 + - name: Create GitHub Release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 with: - name: msix-package-${{ env.BUILD_PLATFORM }} - path: | + name: "v${{ steps.version.outputs.number }}" + tag_name: "v${{ steps.version.outputs.number }}" + draft: false + prerelease: false + files: | ${{ env.APPX_PACKAGE_DIR }}/**/*.msix ${{ env.APPX_PACKAGE_DIR }}/**/*.msixbundle ${{ env.APPX_PACKAGE_DIR }}/**/*.appxupload - retention-days: 30 + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Update App Installer file + if: startsWith(github.ref, 'refs/tags/v') + run: | + $appInstallerPath = "${{ env.APPX_PACKAGE_DIR }}" + $appInstallerFile = Get-ChildItem -Recurse -Path $appInstallerPath -Name "*.appinstaller" | Select-Object -First 1 + + if ($appInstallerFile) { + $fullPath = Join-Path $appInstallerPath $appInstallerFile + [xml]$xml = Get-Content $fullPath + + # Update the Uri to point to GitHub Pages + $xml.AppInstaller.Uri = "https://apps.neptuo.com/snippetmanager/Neptuo.Productivity.SnippetManager.Package.appinstaller" + + # Update the MainBundle Uri to point to GitHub release + $bundleName = "Neptuo.Productivity.SnippetManager.Package_${{ steps.version.outputs.appx }}_${{ env.BUILD_PLATFORM }}_Release.msixbundle" + $xml.AppInstaller.MainBundle.Uri = "https://github.com/neptuo/Productivity.SnippetManager/releases/download/v${{ steps.version.outputs.number }}/$bundleName" + + $xml.Save($fullPath) + Write-Output "Updated App Installer file: $fullPath" + Write-Output "Bundle URL: $($xml.AppInstaller.MainBundle.Uri)" + } else { + Write-Error "App Installer file not found" + exit 1 + } + + - name: Prepare files for GitHub Pages + if: startsWith(github.ref, 'refs/tags/v') + run: | + $deployDir = "${{ github.workspace }}/deploy" + New-Item -ItemType Directory -Path $deployDir -Force + + # Copy only .appinstaller and .html files + Get-ChildItem -Recurse -Path "${{ env.APPX_PACKAGE_DIR }}" -Include "*.appinstaller", "*.html" | ForEach-Object { + Copy-Item $_.FullName -Destination $deployDir + Write-Host "Copied: $($_.Name)" + } + + Write-Host "Files prepared for deployment:" + Get-ChildItem $deployDir | Format-Table -AutoSize + + - name: Deploy to GitHub Pages + if: startsWith(github.ref, 'refs/tags/v') + uses: JamesIves/github-pages-deploy-action@v4 + with: + token: ${{ secrets.PAGES_DEPLOY_TOKEN }} + repository-name: neptuo/com.neptuo.apps + branch: main + folder: ${{ github.workspace }}/deploy + target-folder: snippetmanager + clean: true + single-commit: true + commit-message: "Deploy Snippet Manager v${{ steps.version.outputs.number }}" - - name: Upload App Installer artifacts + # Upload artifacts for development builds (non-tag pushes) + - name: Upload development build artifacts + if: ${{ !startsWith(github.ref, 'refs/tags/v') }} uses: actions/upload-artifact@v4 - if: always() with: - name: app-installer-${{ env.BUILD_PLATFORM }} + name: dev-build-${{ env.BUILD_PLATFORM }}-${{ github.sha }} path: | + ${{ env.APPX_PACKAGE_DIR }}/**/*.msix + ${{ env.APPX_PACKAGE_DIR }}/**/*.msixbundle + ${{ env.APPX_PACKAGE_DIR }}/**/*.appxupload ${{ env.APPX_PACKAGE_DIR }}/**/*.appinstaller ${{ env.APPX_PACKAGE_DIR }}/**/*.html - retention-days: 30 + retention-days: 7 - name: Upload build logs uses: actions/upload-artifact@v4 From 45f40a42ec403ff9de7015c83cc40761bafb1fed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 10:07:37 +0200 Subject: [PATCH 06/13] Run on tags only --- .github/workflows/deploy.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index de434ed..4b6199a 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -2,10 +2,7 @@ name: Build and Deploy on: push: - branches: [ main ] tags: [ 'v*' ] - pull_request: - branches: [ main ] workflow_dispatch: # Allow manual trigger env: From df865713a24311e4f2c877dd0f693da9e267edd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 10:15:55 +0200 Subject: [PATCH 07/13] Run gh-pages on ubuntu --- .github/workflows/deploy.yml | 43 +++++++++++++++++++++++++++--------- 1 file changed, 33 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4b6199a..14676cd 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,6 +14,10 @@ env: jobs: build: runs-on: windows-latest + outputs: + version-number: ${{ steps.version.outputs.number }} + version-appx: ${{ steps.version.outputs.appx }} + is-release: ${{ startsWith(github.ref, 'refs/tags/v') }} steps: - name: Checkout code @@ -139,18 +143,13 @@ jobs: Write-Host "Files prepared for deployment:" Get-ChildItem $deployDir | Format-Table -AutoSize - - name: Deploy to GitHub Pages + - name: Upload deployment files if: startsWith(github.ref, 'refs/tags/v') - uses: JamesIves/github-pages-deploy-action@v4 + uses: actions/upload-artifact@v4 with: - token: ${{ secrets.PAGES_DEPLOY_TOKEN }} - repository-name: neptuo/com.neptuo.apps - branch: main - folder: ${{ github.workspace }}/deploy - target-folder: snippetmanager - clean: true - single-commit: true - commit-message: "Deploy Snippet Manager v${{ steps.version.outputs.number }}" + name: deployment-files + path: ${{ github.workspace }}/deploy + retention-days: 1 # Upload artifacts for development builds (non-tag pushes) - name: Upload development build artifacts @@ -175,3 +174,27 @@ jobs: **/*.log **/*.binlog retention-days: 7 + + deploy: + needs: build + runs-on: ubuntu-latest + if: needs.build.outputs.is-release == 'true' + + steps: + - name: Download deployment files + uses: actions/download-artifact@v4 + with: + name: deployment-files + path: ./deploy + + - name: Deploy to GitHub Pages + uses: JamesIves/github-pages-deploy-action@v4 + with: + token: ${{ secrets.PAGES_DEPLOY_TOKEN }} + repository-name: neptuo/com.neptuo.apps + branch: main + folder: ./deploy + target-folder: snippetmanager + clean: true + single-commit: true + commit-message: "Deploy Snippet Manager v${{ needs.build.outputs.version-number }}" From e49a4b412d625e7b0a6f54e16c970754a6f1e30e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 10:23:56 +0200 Subject: [PATCH 08/13] Fix missing git folder for deploy --- .github/workflows/deploy.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 14676cd..4c73e5b 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -181,6 +181,9 @@ jobs: if: needs.build.outputs.is-release == 'true' steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Download deployment files uses: actions/download-artifact@v4 with: @@ -190,7 +193,7 @@ jobs: - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 with: - token: ${{ secrets.PAGES_DEPLOY_TOKEN }} + # token: ${{ secrets.PAGES_DEPLOY_TOKEN }} repository-name: neptuo/com.neptuo.apps branch: main folder: ./deploy From c6fab177b45eac895f89342a2696a12fc136a996 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 10:40:03 +0200 Subject: [PATCH 09/13] Try to use secrets.GITHUB_TOKEN --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 4c73e5b..0013295 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -193,7 +193,7 @@ jobs: - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 with: - # token: ${{ secrets.PAGES_DEPLOY_TOKEN }} + token: ${{ secrets.GITHUB_TOKEN }} repository-name: neptuo/com.neptuo.apps branch: main folder: ./deploy From b7ea1dc6877fd0ddf768963491fd0c299923e4ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 10:48:02 +0200 Subject: [PATCH 10/13] Use different token --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 0013295..c10984f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -193,7 +193,7 @@ jobs: - name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.PAGES_DEPLOY_TOKEN }} repository-name: neptuo/com.neptuo.apps branch: main folder: ./deploy From 03de6700b6656883fe367c0101d4fc4db82e9530 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 11:00:35 +0200 Subject: [PATCH 11/13] Deploy to gh-pages branch --- .github/workflows/deploy.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c10984f..5d53be6 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -195,6 +195,7 @@ jobs: with: token: ${{ secrets.PAGES_DEPLOY_TOKEN }} repository-name: neptuo/com.neptuo.apps + branch: gh-pages branch: main folder: ./deploy target-folder: snippetmanager From 2c46be1ffb4453e1678458a90ab37f4be8c85000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 11:08:41 +0200 Subject: [PATCH 12/13] Fix --- .github/workflows/deploy.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5d53be6..3da5b32 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -196,7 +196,6 @@ jobs: token: ${{ secrets.PAGES_DEPLOY_TOKEN }} repository-name: neptuo/com.neptuo.apps branch: gh-pages - branch: main folder: ./deploy target-folder: snippetmanager clean: true From a121f9e20bc863773871e51d75bca372481fb734 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marek=20Fi=C5=A1era?= Date: Fri, 26 Sep 2025 11:31:22 +0200 Subject: [PATCH 13/13] Remove Release from bundle name --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3da5b32..d54c546 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -117,7 +117,7 @@ jobs: $xml.AppInstaller.Uri = "https://apps.neptuo.com/snippetmanager/Neptuo.Productivity.SnippetManager.Package.appinstaller" # Update the MainBundle Uri to point to GitHub release - $bundleName = "Neptuo.Productivity.SnippetManager.Package_${{ steps.version.outputs.appx }}_${{ env.BUILD_PLATFORM }}_Release.msixbundle" + $bundleName = "Neptuo.Productivity.SnippetManager.Package_${{ steps.version.outputs.appx }}_${{ env.BUILD_PLATFORM }}.msixbundle" $xml.AppInstaller.MainBundle.Uri = "https://github.com/neptuo/Productivity.SnippetManager/releases/download/v${{ steps.version.outputs.number }}/$bundleName" $xml.Save($fullPath)