community_release_actions.yml

 1# IF YOU UPDATE THE NAME OF ANY GITHUB SECRET, YOU MUST CHERRY PICK THE COMMIT
 2# TO BOTH STABLE AND PREVIEW CHANNELS
 3
 4name: Release Actions
 5
 6on:
 7  release:
 8    types: [published]
 9
10jobs:
11  discord_release:
12    if: github.repository_owner == 'zed-industries'
13    runs-on: ubuntu-latest
14    steps:
15      - name: Get release URL
16        id: get-release-url
17        run: |
18          if [ "${{ github.event.release.prerelease }}" == "true" ]; then
19              URL="https://zed.dev/releases/preview"
20          else
21              URL="https://zed.dev/releases/stable"
22          fi
23
24          echo "URL=$URL" >> "$GITHUB_OUTPUT"
25      - name: Get content
26        uses: 2428392/gh-truncate-string-action@b3ff790d21cf42af3ca7579146eedb93c8fb0757 # v1.4.1
27        id: get-content
28        with:
29          stringToTruncate: |
30            📣 Zed [${{ github.event.release.tag_name }}](<${{ steps.get-release-url.outputs.URL }}>) was just released!
31
32            ${{ github.event.release.body }}
33          maxLength: 2000
34          truncationSymbol: "..."
35      - name: Discord Webhook Action
36        uses: tsickert/discord-webhook@c840d45a03a323fbc3f7507ac7769dbd91bfb164 # v5.3.0
37        with:
38          webhook-url: ${{ secrets.DISCORD_WEBHOOK_RELEASE_NOTES }}
39          content: ${{ steps.get-content.outputs.string }}
40
41  send_release_notes_email:
42    if: false && github.repository_owner == 'zed-industries' && !github.event.release.prerelease
43    runs-on: ubuntu-latest
44    steps:
45      - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
46        with:
47          fetch-depth: 0
48
49      - name: Check if release was promoted from preview
50        id: check-promotion-from-preview
51        run: |
52          VERSION="${{ github.event.release.tag_name }}"
53          PREVIEW_TAG="${VERSION}-pre"
54
55          if git rev-parse "$PREVIEW_TAG" > /dev/null 2>&1; then
56              echo "was_promoted_from_preview=true" >> "$GITHUB_OUTPUT"
57          else
58              echo "was_promoted_from_preview=false" >> "$GITHUB_OUTPUT"
59          fi
60
61      - name: Send release notes email
62        if: steps.check-promotion-from-preview.outputs.was_promoted_from_preview == 'true'
63        run: |
64          TAG="${{ github.event.release.tag_name }}"
65          cat << 'EOF' > release_body.txt
66          ${{ github.event.release.body }}
67          EOF
68          jq -n --arg tag "$TAG" --rawfile body release_body.txt '{version: $tag, markdown_body: $body}' \
69            > release_data.json
70          curl -X POST "https://zed.dev/api/send_release_notes_email" \
71            -H "Authorization: Bearer ${{ secrets.RELEASE_NOTES_API_TOKEN }}" \
72            -H "Content-Type: application/json" \
73            -d @release_data.json