-
Notifications
You must be signed in to change notification settings - Fork 4
35 lines (31 loc) · 1.15 KB
/
prerelease-notification.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
name: Prerelease Notification
on:
workflow_dispatch:
push:
tags:
- 'lantern-[0-9]+.[0-9]+.[0-9]+-**'
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- name: Check if release already exists
id: exists
env:
GH_TOKEN: ${{ github.token }}
run: |
echo EXISTING=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/releases \
| jq -r '.[].tag_name' | grep -c "${{ github.ref_name }}") >> "$GITHUB_OUTPUT"
- name: Strip repository name of owner
if: ${{ steps.exists.outputs.EXISTING < 1 }}
id: repo
run: |
echo "REPO_NAME=$(echo ${{ github.repository }} | sed s/'${{ github.repository_owner }}\/'//g)" >> "$GITHUB_OUTPUT"
- name: Send Slack message to Releases channel
if: ${{ steps.exists.outputs.EXISTING < 1 }}
run: |
curl -X POST -H 'Content-type: application/json' \
--data "{\"platform\": \"${{ steps.repo.outputs.REPO_NAME }}\", \"version\": \"${{ github.ref_name }}\"}" \
${{ secrets.SLACK_RELEASES_WEBHOOK }}