forked from alerta/python-alerta-client
-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (74 loc) · 2.01 KB
/
release.yml
File metadata and controls
82 lines (74 loc) · 2.01 KB
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
name: Release
on:
push:
tags: [ 'v*' ]
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Install dependencies
id: install-deps
run: |
python3 -m pip install --upgrade pip
pip install flake8 pytest
pip install -r requirements.txt
pip install -r requirements-dev.txt
pip install .
- name: Pre-commit hooks
id: hooks
run: |
pre-commit run -a --show-diff-on-failure
- name: Test with pytest
id: test
run: |
pytest --cov=alertaclient tests/unit
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
if: failure()
release:
name: Publish
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Build
id: build
run: |
python3 -m pip install --upgrade build
python3 -m build
zip alerta-client.zip -r dist/*
tar cvfz alerta-client.tar.gz dist/*
- name: Release
id: create-release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref }}
name: Release ${{ github.ref }}
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
files: |
./alerta-client.zip
./alerta-client.tar.gz
- uses: act10ns/slack@v2
with:
status: ${{ job.status }}
steps: ${{ toJson(steps) }}
- name: Test Install
run: |
python3 -m pip install --upgrade alerta
python3 -m pip freeze