-
Notifications
You must be signed in to change notification settings - Fork 37
75 lines (71 loc) · 2.2 KB
/
create-gh-release.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
name: create-gh-release
permissions:
contents: write
on:
push:
tags:
- v[0-9]+.*
workflow_dispatch:
inputs:
tag_ref:
description: "refs/tags/v2.6.2"
required: true
type: string
jobs:
create-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# With fetch-depth 0 the checkout action will also fetch all tags and branches. We need the tags for
# ./disallow-major-release.sh to work.
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
- name: Set GITHUB_REF from input
if: "${{ inputs.tag_ref != '' }}"
run: |
echo "GITHUB_REF=${{ inputs.tag_ref }}" >> $GITHUB_ENV
- name: Set GITHUB_REF from original
if: "${{ inputs.tag_ref == '' }}"
run: |
echo "GITHUB_REF=$GITHUB_REF" >> $GITHUB_ENV
- uses: taiki-e/create-gh-release-action@v1
with:
changelog: CHANGELOG.md
draft: true
ref: ${{ env.GITHUB_REF }}
token: ${{ secrets.GH_PAT }}
- name: Send success message
if: "${{ success() }}"
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID_TEAM }}
payload: |
{
"text": "Github release has been created successfully! :tada:",
"attachments": [{
"color": "good",
"fields": [
{
"title": "Releases URL",
"value": "<${{ github.server_url }}/${{ github.repository }}/releases>"
}
]
}]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Send failure message
if: "${{ failure() }}"
uses: slackapi/[email protected]
with:
channel-id: ${{ secrets.SLACK_CHANNEL_ID_TEAM }}
payload: |
{
"text": ":boom: :scream: Github Release has failed! :scream_cat: :sob:",
"attachments": [{
"color": "danger"
}]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}