This repository has been archived by the owner on Dec 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
191 lines (158 loc) · 5.97 KB
/
release.yaml
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: Release
on:
pull_request:
branches: [ main ]
paths-ignore:
- 'README.md'
- '.gitignore'
- 'changelog.json'
jobs:
prepare:
name: Prepare env & label
runs-on: ubuntu-latest
outputs:
get_current_tag: ${{ steps.set_current_tag_id.outputs.current_tag }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Bump version and push tag
id: tag_version
uses: mathieudutour/github-tag-action@v6.0
with:
github_token: ${{ secrets.REPOS_TOKEN }}
- name: Set label release
uses: actions-ecosystem/action-add-labels@v1
with:
labels: release
- name: Add author as assignees
uses: actions-ecosystem/action-add-assignees@v1
with:
assignees: ${{ github.actor }}
github_token: ${{ secrets.REPOS_TOKEN }}
- name: Set tag version to output
id: set_current_tag_id
run: echo "::set-output name=current_tag::${{ steps.tag_version.outputs.new_tag }}"
- name: Notify if failure
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
<b>!!! FAILED !!!</b>
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
release:
name: Create Release
runs-on: ubuntu-latest
needs: prepare
outputs:
get_release_url: ${{ steps.set_release_url.outputs.release_url }}
steps:
- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3
with:
configuration: "changelog.json"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.REPOS_TOKEN }}
with:
tag_name: ${{ needs.prepare.outputs.get_current_tag }}
release_name: Release ${{ needs.prepare.outputs.get_current_tag }}
body: ${{ steps.github_release.outputs.changelog }}
- name: Set Release URL
id: set_release_url
run: echo "::set-output name=release_url::${{ steps.create_release.outputs.upload_url }}"
- name: Notify if failure
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
<b>!!! FAILED !!!</b>
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
build:
name: Build packages
needs: [ prepare, release ]
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
TARGET: windows
CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F butler.py
OUT_FILE_NAME: butler.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
- os: ubuntu-latest
TARGET: ubuntu
CMD_BUILD: python -m PyInstaller --clean --workpath /tmp/build --specpath /tmp -F butler.py
OUT_FILE_NAME: butler
ASSET_MIME: application/x-binary
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build with pyinstaller for ${{ matrix.TARGET }}
run: ${{ matrix.CMD_BUILD }}
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.OUT_FILE_NAME }}
path: ./dist/${{ matrix.OUT_FILE_NAME }}
retention-days: 1
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.release.outputs.get_release_url }}
asset_path: ./dist/${{ matrix.OUT_FILE_NAME }}
asset_name: ${{ matrix.OUT_FILE_NAME }}
asset_content_type: ${{ matrix.ASSET_MIME }}
- name: Notify if failure
if: ${{ failure() }}
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
<b>!!! FAILED !!!</b>
<b>Failed job:</b> https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}
telegram:
runs-on: ubuntu-latest
name: Notification
needs: [ prepare, release, build ]
steps:
- name: Notify telegram message after Released
uses: appleboy/telegram-action@master
with:
to: ${{ secrets.TELEGRAM_CHAT }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: html
message: |
${{ github.actor }} created commit:
<b>WorkFlows:</b> <a href="https://github.com/${{ github.repository }}/actions">ActionsList</a>
Commit with tag: ${{ needs.prepare.outputs.get_current_tag }}
Repository: ${{ github.repository }}
Branch: ${{ github.ref }}
<b>Release URL:</b> https://github.com/${{ github.repository }}/releases/tag/${{ needs.prepare.outputs.get_current_tag }}
See changes: https://github.com/${{ github.repository }}/commit/${{ github.sha }}