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
  8jobs:
  9  rebuild_releases_page:
 10    if: github.repository_owner == 'zed-industries'
 11    runs-on: namespace-profile-2x4-ubuntu-2404
 12    steps:
 13    - name: after_release::rebuild_releases_page::refresh_cloud_releases
 14      run: curl -fX POST https://cloud.zed.dev/releases/refresh?expect_tag=${{ github.event.release.tag_name }}
 15      shell: bash -euxo pipefail {0}
 16    - name: after_release::rebuild_releases_page::redeploy_zed_dev
 17      run: npm exec --yes -- vercel@37 --token="$VERCEL_TOKEN" --scope zed-industries redeploy https://zed.dev
 18      shell: bash -euxo pipefail {0}
 19      env:
 20        VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
 21  post_to_discord:
 22    needs:
 23    - rebuild_releases_page
 24    if: github.repository_owner == 'zed-industries'
 25    runs-on: namespace-profile-2x4-ubuntu-2404
 26    steps:
 27    - id: get-release-url
 28      name: after_release::post_to_discord::get_release_url
 29      run: |
 30        if [ "${{ github.event.release.prerelease }}" == "true" ]; then
 31            URL="https://zed.dev/releases/preview"
 32        else
 33            URL="https://zed.dev/releases/stable"
 34        fi
 35
 36        echo "URL=$URL" >> "$GITHUB_OUTPUT"
 37      shell: bash -euxo pipefail {0}
 38    - id: get-content
 39      name: after_release::post_to_discord::get_content
 40      uses: 2428392/gh-truncate-string-action@b3ff790d21cf42af3ca7579146eedb93c8fb0757
 41      with:
 42        stringToTruncate: |
 43          📣 Zed [${{ github.event.release.tag_name }}](<${{ steps.get-release-url.outputs.URL }}>) was just released!
 44
 45          ${{ github.event.release.body }}
 46        maxLength: 2000
 47        truncationSymbol: '...'
 48    - name: after_release::post_to_discord::discord_webhook_action
 49      uses: tsickert/discord-webhook@c840d45a03a323fbc3f7507ac7769dbd91bfb164
 50      with:
 51        webhook-url: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTES }}
 52        content: ${{ steps.get-content.outputs.string }}
 53  publish_winget:
 54    runs-on: self-32vcpu-windows-2022
 55    steps:
 56    - id: set-package-name
 57      name: after_release::publish_winget::set_package_name
 58      run: |
 59        if ("${{ github.event.release.prerelease }}" -eq "true") {
 60            $PACKAGE_NAME = "ZedIndustries.Zed.Preview"
 61        } else {
 62            $PACKAGE_NAME = "ZedIndustries.Zed"
 63        }
 64
 65        echo "PACKAGE_NAME=$PACKAGE_NAME" >> $env:GITHUB_OUTPUT
 66      shell: pwsh
 67    - name: after_release::publish_winget::winget_releaser
 68      uses: vedantmgoyal9/winget-releaser@19e706d4c9121098010096f9c495a70a7518b30f
 69      with:
 70        identifier: ${{ steps.set-package-name.outputs.PACKAGE_NAME }}
 71        max-versions-to-keep: 5
 72        token: ${{ secrets.WINGET_TOKEN }}
 73  create_sentry_release:
 74    if: github.repository_owner == 'zed-industries'
 75    runs-on: namespace-profile-2x4-ubuntu-2404
 76    steps:
 77    - name: steps::checkout_repo
 78      uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
 79      with:
 80        clean: false
 81    - name: release::create_sentry_release
 82      uses: getsentry/action-release@526942b68292201ac6bbb99b9a0747d4abee354c
 83      with:
 84        environment: production
 85      env:
 86        SENTRY_ORG: zed-dev
 87        SENTRY_PROJECT: zed
 88        SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
 89  notify_on_failure:
 90    needs:
 91    - rebuild_releases_page
 92    - post_to_discord
 93    - publish_winget
 94    - create_sentry_release
 95    if: failure()
 96    runs-on: namespace-profile-2x4-ubuntu-2404
 97    steps:
 98    - name: release::notify_on_failure::notify_slack
 99      run: |-
100        curl -X POST -H 'Content-type: application/json'\
101         --data '{"text":"${{ github.workflow }} failed:  ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' "$SLACK_WEBHOOK"
102      shell: bash -euxo pipefail {0}
103      env:
104        SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_WORKFLOW_FAILURES }}