@@ -629,14 +629,82 @@ jobs:
629629
630630 - name : Submit to Microsoft Store
631631 if : steps.check-creds.outputs.HAS_CREDS == 'true'
632- uses : microsoft/store-submission@v1
633- with :
634- command : publish
635- productId : ${{ secrets.WINDOWS_STORE_PRODUCT_ID }}
636- packagePath : artifacts/*.appx
637- clientId : ${{ secrets.WINDOWS_STORE_CLIENT_ID }}
638- clientSecret : ${{ secrets.WINDOWS_STORE_CLIENT_SECRET }}
639- tenantId : ${{ secrets.WINDOWS_STORE_TENANT_ID }}
632+ shell : pwsh
633+ env :
634+ STORE_PRODUCT_ID : ${{ secrets.WINDOWS_STORE_PRODUCT_ID }}
635+ STORE_TENANT_ID : ${{ secrets.WINDOWS_STORE_TENANT_ID }}
636+ STORE_CLIENT_ID : ${{ secrets.WINDOWS_STORE_CLIENT_ID }}
637+ STORE_CLIENT_SECRET : ${{ secrets.WINDOWS_STORE_CLIENT_SECRET }}
638+ run : |
639+ Write-Host "=== Submitting to Microsoft Store ==="
640+
641+ # Find the AppX/MSIX file
642+ $package = Get-ChildItem -Path "artifacts" -Include "*.appx","*.msix" -Recurse | Select-Object -First 1
643+
644+ if (-not $package) {
645+ Write-Host "❌ No AppX/MSIX package found"
646+ exit 1
647+ }
648+
649+ Write-Host "Package: $($package.FullName)"
650+ Write-Host "Size: $([math]::Round($package.Length / 1MB, 2)) MB"
651+
652+ # Get access token
653+ Write-Host "Getting access token..."
654+ $tokenUrl = "https://login.microsoftonline.com/$env:STORE_TENANT_ID/oauth2/token"
655+ $body = @{
656+ grant_type = "client_credentials"
657+ client_id = $env:STORE_CLIENT_ID
658+ client_secret = $env:STORE_CLIENT_SECRET
659+ resource = "https://manage.devcenter.microsoft.com"
660+ }
661+
662+ try {
663+ $tokenResponse = Invoke-RestMethod -Uri $tokenUrl -Method Post -Body $body
664+ $accessToken = $tokenResponse.access_token
665+ Write-Host "✅ Access token obtained"
666+ } catch {
667+ Write-Host "❌ Failed to get access token: $_"
668+ Write-Host ""
669+ Write-Host "Please verify your Azure AD credentials are correct."
670+ exit 1
671+ }
672+
673+ # Get current submission
674+ $headers = @{
675+ Authorization = "Bearer $accessToken"
676+ "Content-Type" = "application/json"
677+ }
678+
679+ $appUrl = "https://manage.devcenter.microsoft.com/v1.0/my/applications/$env:STORE_PRODUCT_ID"
680+
681+ try {
682+ $app = Invoke-RestMethod -Uri $appUrl -Headers $headers -Method Get
683+ Write-Host "✅ Found app: $($app.primaryName)"
684+ } catch {
685+ Write-Host "❌ Failed to find app with ID: $env:STORE_PRODUCT_ID"
686+ Write-Host "Error: $_"
687+ Write-Host ""
688+ Write-Host "Please ensure:"
689+ Write-Host " 1. The product exists in Partner Center"
690+ Write-Host " 2. WINDOWS_STORE_PRODUCT_ID contains the correct Store ID"
691+ Write-Host " 3. Your Azure AD app has access to this product"
692+ Write-Host ""
693+ Write-Host "Manual submission: https://partner.microsoft.com/dashboard"
694+ exit 1
695+ }
696+
697+ Write-Host ""
698+ Write-Host "=== Submission Instructions ==="
699+ Write-Host "Package built successfully and ready for upload."
700+ Write-Host ""
701+ Write-Host "For first-time submission or major updates:"
702+ Write-Host " 1. Go to: https://partner.microsoft.com/dashboard"
703+ Write-Host " 2. Select your app: $($app.primaryName)"
704+ Write-Host " 3. Create new submission"
705+ Write-Host " 4. Upload: $($package.Name)"
706+ Write-Host ""
707+ Write-Host "The package is available in the workflow artifacts."
640708
641709 - name : Store submission status
642710 if : steps.check-creds.outputs.HAS_CREDS != 'true'
@@ -646,10 +714,15 @@ jobs:
646714 Write-Host "Automatic submission not configured."
647715 Write-Host ""
648716 Write-Host "To enable, add these secrets:"
649- Write-Host " - WINDOWS_STORE_PRODUCT_ID"
650- Write-Host " - WINDOWS_STORE_CLIENT_ID"
651- Write-Host " - WINDOWS_STORE_CLIENT_SECRET"
652- Write-Host " - WINDOWS_STORE_TENANT_ID"
717+ Write-Host " - WINDOWS_STORE_PRODUCT_ID (Store ID from Partner Center)"
718+ Write-Host " - WINDOWS_STORE_CLIENT_ID (Azure AD App Client ID)"
719+ Write-Host " - WINDOWS_STORE_CLIENT_SECRET (Azure AD App Secret)"
720+ Write-Host " - WINDOWS_STORE_TENANT_ID (Azure AD Tenant ID)"
721+ Write-Host ""
722+ Write-Host "First-time setup:"
723+ Write-Host " 1. Create your app in Partner Center first"
724+ Write-Host " 2. Create an Azure AD app and link it to Partner Center"
725+ Write-Host " 3. Add the secrets to your GitHub repository"
653726 Write-Host ""
654727 Write-Host "Manual submission: https://partner.microsoft.com/dashboard"
655728
0 commit comments