-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (96 loc) · 2.77 KB
/
release_package.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
name: Release tagged package
on: [workflow_dispatch]
jobs:
pylint:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
uses: ./.github/workflows/define-pylint.yml
with:
python-version: ${{ matrix.python-version }}
pytest:
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
uses: ./.github/workflows/define-pytest.yml
with:
python-version: ${{ matrix.python-version }}
build:
runs-on: self-hosted
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install build
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Run all tests with pytest
run: |
python -m build
- name: Persist builds
uses: actions/upload-artifact@v4
with:
name: build-dist-${{ matrix.python-version }}
path: dist/*
tag:
runs-on: self-hosted
outputs:
release-tag: ${{ steps.read-tag.outputs.release-tag }}
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
shell: bash
run: |
python -m pip install --upgrade pip
pip install tomli
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Read tag from pyproject.toml
id: read-tag
shell: bash
run: |
TAG=$(python -c 'import tomli; print(tomli.load(open("pyproject.toml", "rb"))["project"]["version"])')
echo "release-tag=$(echo $TAG)" >> GITHUB_OUTPUT
- uses: mukunku/[email protected]
id: check-tag
with:
tag: ${{ steps.read-tag.outputs.release-tag }}
- name: Fail if tag exists
run: |
echo "Tag exists!"
exit 1
if: steps.check-tag.outputs.exists == 'true'
release:
needs: [pylint, pytest, build, tag]
runs-on: self-hosted
permissions:
contents: write
steps:
- uses: actions/checkout@v3
- name: Load persisted builds
uses: actions/download-artifact@v4
with:
pattern: build-dist-*
path: dist/*
merge-multiple: true
- name: Add body.md
shell: bash
run: |
touch body.md
- name: Create new release
uses: ncipollo/release-action@v1
with:
tag: ${{ needs.tag.outputs.release-tag }}
artifacts: "dist/*"
bodyFile: "body.md"