Skip to content

Commit 49bd017

Browse files
[Release|CI/CD] Send release notifications to communication channels only in case of a stable release (#10419)
Closes: paritytech/devops#3831
1 parent 8e9ea65 commit 49bd017

File tree

1 file changed

+51
-15
lines changed

1 file changed

+51
-15
lines changed

.github/workflows/release-99_notif-published.yml

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,47 @@ on:
33
release:
44
types:
55
- published
6-
- prereleased
76

87
jobs:
8+
check_if_release_is_latest:
9+
runs-on: ubuntu-latest
10+
outputs:
11+
is_latest: ${{ steps.check_is_latest.outputs.is_latest }}
12+
steps:
13+
- name: Fetch latest release tag name
14+
id: fetch_latest_release_tag
15+
env:
16+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17+
run: |
18+
TAG_NAME=$(curl -H "Accept: application/vnd.github+json" \
19+
-H "X-GitHub-Api-Version: 2022-11-28" -H "Authorization: Bearer ${GITHUB_TOKEN}" \
20+
-sL "https://api.github.com/repos/${{ github.repository }}/releases/latest" \
21+
| jq -r '.tag_name')
22+
23+
echo "Latest release tag: $TAG_NAME"
24+
echo "latest_tag_name=$TAG_NAME" >> $GITHUB_OUTPUT
25+
- name: Fetch current release tag name
26+
id: fetch_curent_release_tag
27+
run: |
28+
CURRENT_RELEASE_TAG_NAME=${{github.event.release.tag_name}}
29+
echo "Current release tag: $CURRENT_RELEASE_TAG_NAME"
30+
echo "current_tag_name=$CURRENT_RELEASE_TAG_NAME" >> $GITHUB_OUTPUT
31+
32+
- name: Check if release is latest
33+
id: check_is_latest
34+
run: |
35+
if [[ "${{ steps.fetch_latest_release_tag.outputs.latest_tag_name }}" == "${{ steps.fetch_curent_release_tag.outputs.current_tag_name }}" ]]; then
36+
echo "Release is latest"
37+
echo "is_latest=true" >> $GITHUB_OUTPUT
38+
else
39+
echo "Release is not latest"
40+
echo "is_latest=false" >> $GITHUB_OUTPUT
41+
fi
42+
943
ping_matrix:
1044
runs-on: ubuntu-latest
45+
needs: [check_if_release_is_latest]
46+
if: ${{ needs.check_if_release_is_latest.outputs.is_latest == 'true' }}
1147
environment: release
1248
strategy:
1349
matrix:
@@ -20,7 +56,7 @@ jobs:
2056
# External
2157
- name: 'Ledger <> Polkadot Coordination'
2258
room: '!EoIhaKfGPmFOBrNSHT:web3.foundation'
23-
pre-release: true
59+
pre-release: false
2460

2561
# Public
2662
- name: '#polkadotvalidatorlounge:web3.foundation'
@@ -48,18 +84,18 @@ jobs:
4884
echo "Extracted node version: $version"
4985
echo "node_version=$version" >> $GITHUB_OUTPUT
5086
51-
- name: Matrix notification to ${{ matrix.channel.name }}
52-
if: github.event.release.prerelease == false || matrix.channel.pre-release
53-
uses: s3krit/matrix-message-action@70ad3fb812ee0e45ff8999d6af11cafad11a6ecf # v0.0.3
54-
with:
55-
room_id: ${{ matrix.channel.room }}
56-
access_token: ${{ secrets.RELEASENOTES_MATRIX_V2_ACCESS_TOKEN }}
57-
server: m.parity.io
58-
message: |
59-
@room
87+
# - name: Matrix notification to ${{ matrix.channel.name }}
88+
# if: github.event.release.prerelease == false || matrix.channel.pre-release
89+
# uses: s3krit/matrix-message-action@70ad3fb812ee0e45ff8999d6af11cafad11a6ecf # v0.0.3
90+
# with:
91+
# room_id: ${{ matrix.channel.room }}
92+
# access_token: ${{ secrets.RELEASENOTES_MATRIX_V2_ACCESS_TOKEN }}
93+
# server: m.parity.io
94+
# message: |
95+
# @room
6096

61-
A new node release has been ${{github.event.action}} in **${{github.event.repository.full_name}}:**<br/>
62-
Release version: [${{github.event.release.tag_name}}](${{github.event.release.html_url}})<br/>
63-
Node version: ${{ steps.extract_version.outputs.node_version }}
97+
# A new node release has been ${{github.event.action}} in **${{github.event.repository.full_name}}:**<br/>
98+
# Release version: [${{github.event.release.tag_name}}](${{github.event.release.html_url}})<br/>
99+
# Node version: ${{ steps.extract_version.outputs.node_version }}
64100

65-
-----
101+
# -----

0 commit comments

Comments
 (0)