after_release.yml

  1# Generated from xtask::workflows::after_release
  2# Rebuild with `cargo xtask workflows`.
  3name: after_release
  4on:
  5  release:
  6    types:
  7    - published
  8  workflow_dispatch:
  9    inputs:
 10      tag_name:
 11        description: tag_name
 12        required: true
 13        type: string
 14      prerelease:
 15        description: prerelease
 16        required: true
 17        type: boolean
 18      body:
 19        description: body
 20        type: string
 21        default: ''
 22jobs:
 23  rebuild_releases_page:
 24    if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
 25    runs-on: namespace-profile-2x4-ubuntu-2404
 26    steps:
 27    - name: after_release::rebuild_releases_page::refresh_cloud_releases
 28      run: curl -fX POST https://cloud.zed.dev/releases/refresh?expect_tag=${{ github.event.release.tag_name || inputs.tag_name }}
 29    - name: steps::checkout_repo
 30      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
 31      with:
 32        clean: false
 33    - name: after_release::rebuild_releases_page::redeploy_zed_dev
 34      run: ./script/redeploy-vercel
 35      env:
 36        VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
 37  post_to_discord:
 38    needs:
 39    - rebuild_releases_page
 40    if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
 41    runs-on: namespace-profile-2x4-ubuntu-2404
 42    steps:
 43    - id: get-release-url
 44      name: after_release::post_to_discord::get_release_url
 45      run: |
 46        if [ "${{ github.event.release.prerelease || inputs.prerelease }}" == "true" ]; then
 47            URL="https://zed.dev/releases/preview"
 48        else
 49            URL="https://zed.dev/releases/stable"
 50        fi
 51
 52        echo "URL=$URL" >> "$GITHUB_OUTPUT"
 53    - id: get-content
 54      name: after_release::post_to_discord::get_content
 55      uses: 2428392/gh-truncate-string-action@b3ff790d21cf42af3ca7579146eedb93c8fb0757
 56      with:
 57        stringToTruncate: |
 58          📣 Zed [${{ github.event.release.tag_name || inputs.tag_name }}](<${{ steps.get-release-url.outputs.URL }}>)  was just released!
 59
 60          ${{ github.event.release.body || inputs.body }}
 61        maxLength: 2000
 62        truncationSymbol: '...'
 63    - name: after_release::post_to_discord::discord_webhook_action
 64      uses: tsickert/discord-webhook@c840d45a03a323fbc3f7507ac7769dbd91bfb164
 65      with:
 66        webhook-url: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTES }}
 67        content: ${{ steps.get-content.outputs.string }}
 68  publish_winget:
 69    runs-on: self-32vcpu-windows-2022
 70    steps:
 71    - name: after_release::publish_winget::sync_winget_pkgs_fork
 72      run: |
 73        $headers = @{
 74            "Authorization" = "Bearer $env:WINGET_TOKEN"
 75            "Accept" = "application/vnd.github+json"
 76            "X-GitHub-Api-Version" = "2022-11-28"
 77        }
 78        $body = @{ branch = "master" } | ConvertTo-Json
 79        $uri = "https://api.github.com/repos/${{ github.repository_owner }}/winget-pkgs/merge-upstream"
 80        try {
 81            Invoke-RestMethod -Uri $uri -Method Post -Headers $headers -Body $body -ContentType "application/json"
 82            Write-Host "Successfully synced winget-pkgs fork"
 83        } catch {
 84            Write-Host "Fork sync response: $_"
 85            Write-Host "Continuing anyway - fork may already be up to date"
 86        }
 87      shell: pwsh
 88      env:
 89        WINGET_TOKEN: ${{ secrets.WINGET_TOKEN }}
 90    - id: set-package-name
 91      name: after_release::publish_winget::set_package_name
 92      run: |
 93        if ("${{ github.event.release.prerelease || inputs.prerelease }}" -eq "true") {
 94            $PACKAGE_NAME = "ZedIndustries.Zed.Preview"
 95        } else {
 96            $PACKAGE_NAME = "ZedIndustries.Zed"
 97        }
 98
 99        echo "PACKAGE_NAME=$PACKAGE_NAME" >> $env:GITHUB_OUTPUT
100      shell: pwsh
101    - name: after_release::publish_winget::winget_releaser
102      uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f
103      with:
104        identifier: ${{ steps.set-package-name.outputs.PACKAGE_NAME }}
105        release-tag: ${{ github.event.release.tag_name || inputs.tag_name }}
106        max-versions-to-keep: 5
107        token: ${{ secrets.WINGET_TOKEN }}
108  create_sentry_release:
109    if: (github.repository_owner == 'zed-industries' || github.repository_owner == 'zed-extensions')
110    runs-on: namespace-profile-2x4-ubuntu-2404
111    steps:
112    - name: steps::checkout_repo
113      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
114      with:
115        clean: false
116    - name: release::create_sentry_release
117      uses: getsentry/action-release@526942b68292201ac6bbb99b9a0747d4abee354c
118      with:
119        environment: production
120      env:
121        SENTRY_ORG: zed-dev
122        SENTRY_PROJECT: zed
123        SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
124  notify_on_failure:
125    needs:
126    - rebuild_releases_page
127    - post_to_discord
128    - publish_winget
129    - create_sentry_release
130    if: failure()
131    runs-on: namespace-profile-2x4-ubuntu-2404
132    steps:
133    - name: release::send_slack_message
134      run: |
135        curl -X POST -H 'Content-type: application/json'\
136         --data '{"text":"❌ ${{ github.workflow }} failed: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' "$SLACK_WEBHOOK"
137      env:
138        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WORKFLOW_FAILURES }}
139defaults:
140  run:
141    shell: bash -euxo pipefail {0}