-
Notifications
You must be signed in to change notification settings - Fork 11
111 lines (95 loc) · 2.99 KB
/
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Build & Release
run-name: "Releasing"
on:
pull_request:
branches:
- main
types:
- closed
jobs:
generate-version:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.version.outputs.version }}
steps:
- name: Github Checkout
# v4.1.1
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install hatch
run: |
pip install hatch
- name: Get Version
id: version
run: |
echo "version=$(hatch version)" >> $GITHUB_OUTPUT
publish:
runs-on: ubuntu-latest
needs:
- generate-version
permissions:
contents: write
steps:
- name: Github Checkout
# v4.1.1
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Release
# v1.14.0
uses: ncipollo/release-action@2c591bcc8ecdcd2db72b97d6147f871fcd833ba5
with:
tag: ${{ needs.generate-version.outputs.new_version }}
generateReleaseNotes: true
draft: false
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.x"
- name: Install hatch
run: |
pip install hatch
- name: Build SDK
run: |
hatch build
- name: Publish Python 🐍 distributions 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
post-release:
name: Post Release Actions
runs-on: ubuntu-latest
if: ${{ always() }}
needs:
- generate-version
- publish
steps:
- name: Checkout main branch
uses: actions/[email protected]
with:
ref: main
- name: Slack - Success Message
uses: DSdatsme/slack-github-action@env_support
if: ${{ success() && needs.publish.result == 'success' }}
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
payload-file-path: ./.github/resources/slack-payloads/slack-message-template.json
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
RELEASETAG: ${{ needs.generate-version.outputs.new_version }}
PRE_TEXT_MESSAGE: "Workflow Passed! :successkid:"
FALLBACK_MESSAGE: "Workflow Passed!"
COLOR: "good"
- name: Slack - Failure Message
uses: DSdatsme/slack-github-action@env_support
if: ${{ failure() || needs.publish.result != 'success' }}
with:
channel-id: ${{ vars.SLACK_CHANNEL_ID }}
payload-file-path: ./.github/resources/slack-payloads/slack-message-template.json
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
RELEASETAG: ${{ needs.generate-version.outputs.new_version }}
PRE_TEXT_MESSAGE: "<!channel> Workflow Failed! :x:"
FALLBACK_MESSAGE: "Workflow Failed!"
COLOR: "danger"