Skip to content

Commit

Permalink
ci(workflow): enable manual trigger of notif with specific tag input
Browse files Browse the repository at this point in the history
  • Loading branch information
ccamel committed Oct 14, 2024
1 parent fd1fd02 commit 503dfb7
Showing 1 changed file with 37 additions and 13 deletions.
50 changes: 37 additions & 13 deletions .github/workflows/notify-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,55 @@ 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: 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 }}

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

- name: Set ENV variables
run: |
echo "REPO_NAME=${GITHUB_REPOSITORY#$GITHUB_REPOSITORY_OWNER/}" >> $GITHUB_ENV
- name: Extract changelog for tag
run: |
{
echo 'CHANGELOG<<EOF'
gh release view $TAG --json body -q '.body'
gh release view ${{ needs.set-env.outputs.tag }} --json body -q '.body'
echo 'EOF'
} >> "$GITHUB_ENV"
env:
TAG: ${{ github.event.release.tag_name }}
GH_TOKEN: ${{ secrets.OPS_TOKEN }}

- name: Create an announcement discussion for release
uses: abirismyname/[email protected]
with:
title: πŸŽ‰ ${{ env.REPO_NAME }} ${{ github.event.release.tag_name }} released!
title: πŸŽ‰ ${{ needs.set-env.outputs.repo_name }} ${{ needs.set-env.outputs.tag }} released!
body: |
Hey frens! [${{ github.repository }}](https://github.com/${{ github.repository }}) `${{ github.event.release.tag_name }}` just dropped! πŸš€
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! πŸ”₯
Expand All @@ -40,21 +62,22 @@ jobs:
# Resources
πŸ“„ Changelog: <https://github.com/${{ github.repository }}/releases/tag/${{ github.event.release.tag_name }}>
πŸ“„ 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: "https://discord.gg/axone"
TWITTER_URL: "https://twitter.com/axonexyz"
REPOSITORY_ID: "R_kgDOLsWt6A"
CATEGORY_ID: "DIC_kwDOLsWt6M4CemGO"
DISCORD_URL: ${{ vars.DISCORD_URL }}
TWITTER_URL: ${{ vars.TWITTER_URL }}
REPOSITORY_ID: ${{ vars.DISCUSSIONS_REPOSITORY_ID }}
CATEGORY_ID: ${{ vars.DISCUSSIONS_CATEGORY_ID }}

update-docs:
runs-on: ubuntu-22.04
if: github.event_name != 'workflow_dispatch'
steps:
- name: Update modules docs repository
uses: fjogeleit/http-request-action@v1
Expand Down Expand Up @@ -109,6 +132,7 @@ jobs:
update-docs-version:
runs-on: ubuntu-22.04
if: github.event_name != 'workflow_dispatch'
steps:
- name: Update docs version
uses: fjogeleit/http-request-action@v1
Expand Down

0 comments on commit 503dfb7

Please sign in to comment.