@@ -361,25 +361,27 @@ Root: HKCU; Subkey: "SOFTWARE\Classes\CLSID\{{CLSID-HERE}}\LocalServer32"; Value
361361#
362362# To use this template for a new extension:
363363# 1. Copy this file to your extension's project folder as "build-exe.ps1"
364- # 2. Replace EXTENSION_NAME with your extension name (e.g., CmdPalMyExtension)
365- # 3. Replace <VERSION> with your extension version (e.g., 0.0.1.0)
366- # 4. Update the default version to match your project file's AppxPackageVersion
364+ # 2. Update in param():
365+ # - EXTENSION_NAME with your extension name (e.g., CmdPalMyExtension)
366+ # - VERSION with your extension version (e.g., 0.0.1.0)
367+
368+
367369
368370param(
371+ [string]$ExtensionName = "UPDATE", # Change to your extension name
369372 [string]$Configuration = "Release",
370- [string]$Version = "<VERSION>",
373+ [string]$Version = "UPDATE", # Change to your version
371374 [string]$Platform = @("x64", "arm64")
372375)
373376
374377$ErrorActionPreference = "Stop"
375378
376- Write-Host "Building EXTENSION_NAME EXE installer..." -ForegroundColor Green
377- Write-Host "Version: $Version" -ForegroundColor Yellow
379+ Write-Host "Building $ExtensionName EXE installer..." -ForegroundColor GreenWrite-Host "Version: $Version" -ForegroundColor Yellow
378380Write-Host "Platforms: $($Platforms -join ', ')" -ForegroundColor Yellow
379381
380382
381383$ProjectDir = Split-Path -Parent $MyInvocation.MyCommand.Path
382- $ProjectFile = "$ProjectDir\E XTENSION_NAME .csproj"
384+ $ProjectFile = "$ProjectDir\$ ExtensionName .csproj"
383385
384386# Clean previous builds
385387Write-Host "Cleaning previous builds..." -ForegroundColor Yellow
@@ -562,7 +564,7 @@ jobs:
562564 if ("${{ github.event.inputs.version }}" -ne "") {
563565 $version = "${{ github.event.inputs.version }}"
564566 } else {
565- $projectFile = "FOLDER_NAME/ EXTENSION_NAME.csproj"
567+ $projectFile = "${{ env. FOLDER_NAME }}/${{ env. EXTENSION_NAME }} .csproj"
566568 $xml = [xml](Get-Content $projectFile)
567569 $version = $xml.Project.PropertyGroup.AppxPackageVersion | Select-Object -First 1
568570 if (-not $version) { throw "Version not found in project file" }
@@ -573,31 +575,31 @@ jobs:
573575
574576 - name : Build EXE installers (x64 and ARM64)
575577 run : |
576- Set-Location "FOLDER_NAME/ FOLDER_NAME"
578+ Set-Location "${{ env. FOLDER_NAME }}/${{ env. FOLDER_NAME }} "
577579 .\build-exe.ps1 -Version "${{ steps.version.outputs.VERSION }}" -Platforms @("x64", "arm64")
578580 shell : pwsh
579581
580582 - name : Upload x64 installer artifact
581583 uses : actions/upload-artifact@v4
582584 with :
583- name : EXTENSION_NAME-x64-installer
584- path : FOLDER_NAME/bin/Release/installer/*-x64.exe
585+ name : ${{ env. EXTENSION_NAME }} -x64-installer
586+ path : ${{ env. FOLDER_NAME }} /bin/Release/installer/*-x64.exe
585587 if-no-files-found : error
586588
587589 - name : Upload ARM64 installer artifact
588590 uses : actions/upload-artifact@v4
589591 with :
590- name : EXTENSION_NAME-arm64-installer
591- path : FOLDER_NAME/bin/Release/installer/*-arm64.exe
592+ name : ${{ env. EXTENSION_NAME }} -arm64-installer
593+ path : ${{ env. FOLDER_NAME }} /bin/Release/installer/*-arm64.exe
592594 if-no-files-found : warn
593595
594596 - name : Create GitHub Release
595597 uses : softprops/action-gh-release@v1
596598 with :
597- tag_name : EXTENSION_NAME-v${{ steps.version.outputs.VERSION }}
598- name : " DISPLAY_NAME v${{ steps.version.outputs.VERSION }}"
599+ tag_name : ${{ env. EXTENSION_NAME }} -v${{ steps.version.outputs.VERSION }}
600+ name : " ${{ env. DISPLAY_NAME }} v${{ steps.version.outputs.VERSION }}"
599601 body : |
600- ## 🎯 DISPLAY_NAME ${{ steps.version.outputs.VERSION }}
602+ ## 🎯 ${{ env. DISPLAY_NAME }} ${{ steps.version.outputs.VERSION }}
601603
602604 ## What's New
603605 ${{ github.event.inputs.release_notes }}
@@ -606,8 +608,8 @@ jobs:
606608
607609 Download the installer for your system architecture:
608610
609- - **x64 (Intel/AMD)**: `DISPLAY_NAME-Setup-${{ steps.version.outputs.VERSION }}-x64.exe`
610- - **ARM64 (Windows on ARM)**: `DISPLAY_NAME-Setup-${{ steps.version.outputs.VERSION }}-arm64.exe`
611+ - **x64 (Intel/AMD)**: `${{ env. DISPLAY_NAME }} -Setup-${{ steps.version.outputs.VERSION }}-x64.exe`
612+ - **ARM64 (Windows on ARM)**: `${{ env. DISPLAY_NAME }} -Setup-${{ steps.version.outputs.VERSION }}-arm64.exe`
611613
612614 1. Download the appropriate installer from the Assets section below
613615 2. Run the installer with administrator privileges
@@ -616,16 +618,16 @@ jobs:
616618
617619 ## 🔗 More Information
618620
619- Repository: GITHUB_REPO_URL
620- files : FOLDER_NAME/bin/Release/installer/*.exe
621+ Repository: ${{ env. GITHUB_REPO_URL }}
622+ files : ${{ env. FOLDER_NAME }} /bin/Release/installer/*.exe
621623 draft : false
622624 prerelease : false
623625 env :
624626 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
625627
626628 - name : Build summary
627629 run : |
628- Write-Host "🎉 DISPLAY_NAME Release Complete!" -ForegroundColor Green
630+ Write-Host "🎉 ${{ env. DISPLAY_NAME }} Release Complete!" -ForegroundColor Green
629631 Write-Host "Version: ${{ steps.version.outputs.VERSION }}" -ForegroundColor Yellow
630632 Write-Host "📁 Installer uploaded to GitHub Release" -ForegroundColor Green
631633 shell : pwsh
@@ -699,13 +701,16 @@ You can use GitHub Actions to update your already submitted projects to WinGet.
699701
700702Check out how [PowerToys](https://github.com/microsoft/PowerToys/blob/main/.github/workflows/package-submissions.yml) does this.
701703
702- You can also use the following `.github\workflows\update-winget-randomriddle .yml` :
704+ You can also use the following `.github\workflows\update-winget.yml` :
703705
704706` ` ` yml
705- # Replace EXTENSION_NAME
706- # Replace GITHUB_USER_NAME
707- # Replace GITHUB_REPO
708- # Repalce YOUR_PACKAGE_IDENTITY_NAME_HERE with the AppxPackageIdentityName located in the <ExtensionName>.csproj
707+ # To use this template for a new extension:
708+ # 1. Copy this file to a new workflow file (e.g., update-winget.yml)
709+ # 2. Update Environmental variables with your data:
710+ # - GITHUB_REPO with your GitHub repo name
711+ # - GITHUB_REPO with your github user name (e.g., chatasweetie)
712+ # - EXTENSION_NAME with your extension name (e.g., CmdPalMyExtension)
713+ # - YOUR_PACKAGE_IDENTITY_NAME_HERE with the AppxPackageIdentityName located in the <ExtensionName>.csproj
709714
710715
711716name: Update WinGet - EXTENSION_NAME Extension
@@ -724,17 +729,17 @@ on:
724729 required: false
725730 type: string
726731
727- # Global constants: UPDATE THESE, example; DISPLAY_NAME : ${{ vars.DISPLAY_NAME || 'CmdPal Name ' }}
732+ # Global constants: UPDATE THESE, example; EXTENSION_NAME : ${{ vars.EXTENSION_NAME || 'CmdPalMyExtension ' }}
728733env:
729- DISPLAY_NAME : ${{ vars.DISPLAY_NAME || 'DISPLAY_NAME ' }}
730- EXTENSION_NAME : ${{ vars.GITHUB_USER_NAME || 'GITHUB_USER_NAME' }}
731- FOLDER_NAME : ${{ vars.GITHUB_REPO || 'GITHUB_REPO' }}
732- GITHUB_REPO_URL : ${{ vars.YOUR_PACKAGE_IDENTITY_NAME_HERE || 'YOUR_PACKAGE_IDENTITY_NAME_HERE' }}
734+ EXTENSION_NAME : ${{ vars.EXTENSION_NAME || 'EXTENSION_NAME ' }}
735+ GITHUB_USER_NAME : ${{ vars.GITHUB_USER_NAME || 'GITHUB_USER_NAME' }}
736+ GITHUB_REPO : ${{ vars.GITHUB_REPO || 'GITHUB_REPO' }}
737+ YOUR_PACKAGE_IDENTITY_NAME_HERE : ${{ vars.YOUR_PACKAGE_IDENTITY_NAME_HERE || 'YOUR_PACKAGE_IDENTITY_NAME_HERE' }}
733738
734739jobs:
735740 update-winget:
736- # Only run if this is a EXTENSION_NAME release
737- if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.name, 'EXTENSION_NAME Extension')
741+ # Only run if this is a matching extension release
742+ if: github.event_name == 'workflow_dispatch' || startsWith(github.event.release.name, '${{ env. EXTENSION_NAME }} Extension')
738743 runs-on: windows-latest
739744 steps:
740745 - name: Checkout code
@@ -749,13 +754,13 @@ jobs:
749754 echo "TAG=${{ inputs.release_tag }}" >> $env:GITHUB_OUTPUT
750755 } elseif ("${{ github.event_name }}" -eq "release") {
751756 # Extract from release event
752- $version = "${{ github.event.release.tag_name }}" -replace "EXTENSION_NAME-v", ""
757+ $version = "${{ github.event.release.tag_name }}" -replace "${{ env. EXTENSION_NAME }} -v", ""
753758 echo "VERSION=$version" >> $env:GITHUB_OUTPUT
754759 echo "TAG=${{ github.event.release.tag_name }}" >> $env:GITHUB_OUTPUT
755760 } else {
756761 # Get latest release
757- $latestRelease = gh release list --limit 1 --json tagName,name | ConvertFrom-Json | Where-Object { $_.name -like "EXTENSION_NAME Extension*" }
758- $version = $latestRelease.tagName -replace "EXTENSION_NAME-v", ""
762+ $latestRelease = gh release list --limit 1 --json tagName,name | ConvertFrom-Json | Where-Object { $_.name -like "${{ env. EXTENSION_NAME }} Extension*" }
763+ $version = $latestRelease.tagName -replace "${{ env. EXTENSION_NAME }} -v", ""
759764 echo "VERSION=$version" >> $env:GITHUB_OUTPUT
760765 echo "TAG=$($latestRelease.tagName)" >> $env:GITHUB_OUTPUT
761766 }
@@ -774,20 +779,19 @@ jobs:
774779 $tag = "${{ steps.release.outputs.TAG }}"
775780
776781 # URLs for both installers
777- $x64Url = "https://github.com/GITHUB_USER_NAME/ GITHUB_REPO/releases/download/$tag/EXTENSION_NAME-Setup-$version-x64.exe"
778- $arm64Url = "https://github.com/GITHUB_USER_NAME/ GITHUB_REPO/releases/download/$tag/EXTENSION_NAME-Setup-$version-arm64.exe"
782+ $x64Url = "https://github.com/${{ env. GITHUB_USER_NAME }}/${{ env. GITHUB_REPO }} /releases/download/$tag/${{ env. EXTENSION_NAME }} -Setup-$version-x64.exe"
783+ $arm64Url = "https://github.com/${{ env. GITHUB_USER_NAME }}/${{ env. GITHUB_REPO }} /releases/download/$tag/${{ env. EXTENSION_NAME }} -Setup-$version-arm64.exe"
779784
780785 Write-Host "Updating WinGet manifest for version $version"
781786 Write-Host "x64 URL: $x64Url"
782787 Write-Host "ARM64 URL: $arm64Url"
783788
784789 # Update the manifest with both architecture installers
785- .\w ingetcreate.exe update YOUR_PACKAGE_IDENTITY_NAME_HERE `
790+ .\w ingetcreate.exe update ${{ env. YOUR_PACKAGE_IDENTITY_NAME_HERE }} `
786791 --version $version `
787792 --urls "$x64Url|x64" "$arm64Url|arm64" `
788793 --token $env:GITHUB_TOKEN `
789794 --submit
790-
791795```
792796
793797
0 commit comments