This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
90 lines (79 loc) · 3.97 KB
/
release-notifier.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# This action is to send a release message to our Discord community.
# - It will only trigger when our release workflow completes successfully or be triggered manually.
# - When triggering this manually you will need to select Branch > Tags > Select the release you want to notify. (Generally the release you just updated from a pre-release.)
name: Send Release Messages
on:
workflow_run:
workflows: ["release"]
types:
- completed
workflow_dispatch:
inputs:
branch_name:
description: "Please run this workflow from the tag of the release you updated"
required: true
type: boolean
notify_community:
description: "I understand that running this workflow will notify the community of my actions"
required: true
type: boolean
jobs:
send_message:
runs-on: ubuntu-latest
if: (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'workflow_dispatch' ) || github.event_name == 'workflow_dispatch'
steps:
- name: Get release by Tag for manual run
if: ${{ github.event_name == 'workflow_dispatch' }}
id: manual_release_info
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitSha: ${{ github.sha }}
prerelease: false
- name: Get release by Tag for release run
if: ${{ github.event_name == 'workflow_run' }}
id: release_info
uses: cardinalby/git-get-release-action@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commitSha: ${{ github.event.workflow_run.head_sha }}
prerelease: false
latest: true
- name: Send Discord Message
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == steps.release_info.outputs.tag_name}}
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@master
with:
args: |
${{ steps.release_info.outputs.tag_name || steps.manual_release_info.outputs.tag_name }} of ${{ github.repository }} has been released!
*Release Name:**
```
${{ steps.release_info.outputs.name || steps.manual_release_info.outputs.name }}
```
*Release Description:**
```
${{ steps.release_info.outputs.body || steps.manual_release_info.outputs.body }}
```
Read more at: ${{ steps.release_info.outputs.html_url || steps.manual_release_info.outputs.html_url }}
You can also update by visiting our docs at:
https://docs.subspace.network/docs/protocol/cli
- name: Create Issue in subspace-docs repository
if: ${{ github.event_name == 'workflow_dispatch' || github.event_name == 'workflow_run' && github.event.workflow_run.head_branch == steps.release_info.outputs.tag_name}}
uses: dacbd/create-issue-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
owner: 'subspace'
repo: 'subspace-docs'
title: 'Update docs for release ${{ steps.release_info.outputs.tag_name || steps.manual_release_info.outputs.tag_name }}'
# TODO: Setup Github Organization Team for Product Team and add @Product tag to the body, to notify non-subscribed team members of the open issue.
body: |
A new release of ${{ github.repository }} is was released and marked latest.
Documentation requires update, please update prior version to ${{ steps.release_info.outputs.name || steps.manual_release_info.outputs.name }}
*Release Description:**
${{ steps.release_info.outputs.body || steps.manual_release_info.outputs.body }}
Read more at: ${{ steps.release_info.outputs.html_url || steps.manual_release_info.outputs.html_url }}