Skip to content

Commit

Permalink
Merge pull request #39 from axone-protocol/ci/notify-release
Browse files Browse the repository at this point in the history
ci(workflow): add notify-release workflow
  • Loading branch information
ccamel authored Jan 27, 2025
2 parents 5b480b9 + 383bc21 commit 1b71c85
Showing 1 changed file with 80 additions and 0 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/notify-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: Notify release

on:
release:
types: [published]

workflow_dispatch:
inputs:
tag:
description: "Release tag (leave empty for last one)"
jobs:
set-env:
runs-on: ubuntu-22.04
outputs:
tag: ${{ steps.set-env.outputs.tag }}
repo_name: ${{ steps.set-env.outputs.repo_name }}
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Expose tag and repo_name
id: set-env
run: |
if [ -n "$INPUT_TAG" ]; then
TAG="$INPUT_TAG"
else
TAG=$(gh release view --json tagName -q '.tagName')
fi
echo "tag=$TAG" >> $GITHUB_OUTPUT
REPO_NAME=${GITHUB_REPOSITORY#${GITHUB_REPOSITORY_OWNER}/}
echo "repo_name=$REPO_NAME" >> $GITHUB_OUTPUT
env:
INPUT_TAG: ${{ github.event.inputs.tag }}
GH_TOKEN: ${{ secrets.OPS_TOKEN }}

notify-github-discussion:
runs-on: ubuntu-22.04
needs: set-env
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Extract changelog for tag
run: |
{
echo 'CHANGELOG<<EOF'
gh release view ${{ needs.set-env.outputs.tag }} --json body -q '.body'
echo 'EOF'
} >> "$GITHUB_ENV"
env:
GH_TOKEN: ${{ secrets.OPS_TOKEN }}

- name: Create an announcement discussion for release
uses: abirismyname/[email protected]
with:
title: 🎉 ${{ needs.set-env.outputs.repo_name }} ${{ needs.set-env.outputs.tag }} released!
body: |
Hey frens! [${{ github.repository }}](https://github.com/${{ github.repository }}) `${{ needs.set-env.outputs.tag }}` just dropped! 🚀
Some fresh updates are here. Dive into the changelog and see what's cooking! 🔥
# Changelog
${{ env.CHANGELOG }}
# Resources
📄 Changelog: <https://github.com/${{ github.repository }}/releases/tag/${{ needs.set-env.outputs.tag }}>
🛠️ Official repo: <https://github.com/${{ github.repository }}>
💬 Vibe with us on Discord: <${{ env.DISCORD_URL }}>
🐦 Catch us on Twitter: <${{ env.TWITTER_URL }}>
repository-id: ${{ env.REPOSITORY_ID }}
category-id: ${{ env.CATEGORY_ID }}
env:
GH_TOKEN: ${{ secrets.OPS_TOKEN }}
DISCORD_URL: ${{ vars.DISCORD_URL }}
TWITTER_URL: ${{ vars.TWITTER_URL }}
REPOSITORY_ID: ${{ vars.DISCUSSIONS_REPOSITORY_ID }}
CATEGORY_ID: ${{ vars.DISCUSSIONS_CATEGORY_ID }}

0 comments on commit 1b71c85

Please sign in to comment.