Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Sync the winget repo before publishing (#46093)
Conrad Irwindd0d51bd027b
diff --git a/.github/workflows/after_release.yml b/.github/workflows/after_release.ymlindex 21b9a8fe0e1..9130d098890 100644--- a/.github/workflows/after_release.yml+++ b/.github/workflows/after_release.yml@@ -67,6 +67,25 @@ jobs:publish_winget:runs-on: self-32vcpu-windows-2022steps:+ - name: after_release::publish_winget::sync_winget_pkgs_fork+ run: |+ $headers = @{+ "Authorization" = "Bearer $env:WINGET_TOKEN"+ "Accept" = "application/vnd.github+json"+ "X-GitHub-Api-Version" = "2022-11-28"+ }+ $body = @{ branch = "master" } | ConvertTo-Json+ $uri = "https://api.github.com/repos/${{ github.repository_owner }}/winget-pkgs/merge-upstream"+ try {+ Invoke-RestMethod -Uri $uri -Method Post -Headers $headers -Body $body -ContentType "application/json"+ Write-Host "Successfully synced winget-pkgs fork"+ } catch {+ Write-Host "Fork sync response: $_"+ Write-Host "Continuing anyway - fork may already be up to date"+ }+ shell: pwsh+ env:+ WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}- id: set-package-namename: after_release::publish_winget::set_package_namerun: |diff --git a/tooling/xtask/src/tasks/workflows/after_release.rs b/tooling/xtask/src/tasks/workflows/after_release.rsindex c4756171971..c5171002bfa 100644--- a/tooling/xtask/src/tasks/workflows/after_release.rs+++ b/tooling/xtask/src/tasks/workflows/after_release.rs@@ -115,6 +115,26 @@ echo "URL=$URL" >> "$GITHUB_OUTPUT"}fn publish_winget() -> NamedJob {+ fn sync_winget_pkgs_fork() -> Step<Run> {+ named::pwsh(indoc::indoc! {r#"+ $headers = @{+ "Authorization" = "Bearer $env:WINGET_TOKEN"+ "Accept" = "application/vnd.github+json"+ "X-GitHub-Api-Version" = "2022-11-28"+ }+ $body = @{ branch = "master" } | ConvertTo-Json+ $uri = "https://api.github.com/repos/${{ github.repository_owner }}/winget-pkgs/merge-upstream"+ try {+ Invoke-RestMethod -Uri $uri -Method Post -Headers $headers -Body $body -ContentType "application/json"+ Write-Host "Successfully synced winget-pkgs fork"+ } catch {+ Write-Host "Fork sync response: $_"+ Write-Host "Continuing anyway - fork may already be up to date"+ }+ "#})+ .add_env(("WINGET_TOKEN", vars::WINGET_TOKEN))+ }+fn set_package_name() -> (Step<Run>, StepOutput) {let script = format!(r#"if ("{IS_PRERELEASE}" -eq "true") {{@@ -149,6 +169,7 @@ echo "PACKAGE_NAME=$PACKAGE_NAME" >> $env:GITHUB_OUTPUTnamed::job(Job::default().runs_on(runners::WINDOWS_DEFAULT)+ .add_step(sync_winget_pkgs_fork()).add_step(set_package_name).add_step(winget_releaser(&package_name)),)