Skip to content

Commit e5a19f1

Browse files
authored
Merge pull request #40 from Aiven-Open/vitali-add-gh-actions-release
gh-actions: added releasing at tag pushing
2 parents dfe88b1 + e3a82ad commit e5a19f1

File tree

1 file changed

+62
-27
lines changed

1 file changed

+62
-27
lines changed

.github/workflows/build.yml

Lines changed: 62 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Test aiven-mysql-migrate
1+
name: Test and Release aiven-mysql-migrate
22

33
on:
44
push:
@@ -9,68 +9,103 @@ on:
99
pull_request:
1010

1111
jobs:
12-
1312
static-checks:
14-
1513
runs-on: ubuntu-latest
1614
strategy:
1715
matrix:
18-
# only use one version for the lint step
1916
python-version: [3.11]
2017

2118
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v4
2221

23-
- id: checkout-code
24-
uses: actions/checkout@v2
25-
26-
- id: prepare-python
27-
uses: actions/setup-python@v2
22+
- name: Set up Python ${{ matrix.python-version }}
23+
uses: actions/setup-python@v5
2824
with:
2925
python-version: ${{ matrix.python-version }}
3026

31-
- id: dependencies
32-
run: pip install -e ".[dev]"
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install -e ".[dev]"
3331
34-
- id: statis-checks
32+
- name: Run static checks
3533
run: make static-checks
3634

3735
unittest:
38-
3936
runs-on: ubuntu-latest
4037
needs: static-checks
4138
strategy:
4239
matrix:
4340
python-version: ['3.10', '3.11', '3.12']
4441

4542
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v4
4645

47-
- id: checkout-code
48-
uses: actions/checkout@v1
49-
50-
- id: prepare-python
51-
uses: actions/setup-python@v2
46+
- name: Set up Python ${{ matrix.python-version }}
47+
uses: actions/setup-python@v5
5248
with:
5349
python-version: ${{ matrix.python-version }}
5450

55-
- id: dependencies
56-
run: pip install -e ".[dev]"
51+
- name: Install dependencies
52+
run: |
53+
python -m pip install --upgrade pip
54+
pip install -e ".[dev]"
5755
58-
- id: run-unittests
56+
- name: Run unittests
5957
run: make test
6058

6159
systest:
62-
6360
runs-on: ubuntu-latest
6461
needs:
6562
- static-checks
6663
- unittest
6764

6865
steps:
66+
- name: Checkout code
67+
uses: actions/checkout@v4
6968

70-
- id: checkout-code
71-
uses: actions/checkout@v1
72-
- id: dependencies
73-
run: pip install -e ".[dev]"
74-
- id: run-systests
69+
- name: Set up Python
70+
uses: actions/setup-python@v5
71+
with:
72+
python-version: '3.11'
73+
74+
- name: Install dependencies
75+
run: |
76+
python -m pip install --upgrade pip
77+
pip install -e ".[dev]"
78+
79+
- name: Run system tests
7580
run: make && make systest
7681

82+
build-and-release:
83+
# This job runs only when a tag is pushed
84+
name: Build and Release sdist
85+
runs-on: ubuntu-latest
86+
needs: [systest] # Run only after all tests pass
87+
if: github.ref_type == 'tag'
88+
89+
steps:
90+
- name: Checkout code
91+
uses: actions/checkout@v4
92+
with:
93+
# We need the full git history for setuptools-scm to work correctly
94+
fetch-depth: 0
95+
96+
- name: Set up Python
97+
uses: actions/setup-python@v5
98+
with:
99+
python-version: '3.11'
100+
101+
- name: Install build dependencies
102+
run: python -m pip install --upgrade pip build
103+
104+
- name: Build sdist and wheel
105+
run: python -m build
106+
107+
- name: Create GitHub Release and upload assets
108+
uses: softprops/action-gh-release@v2
109+
with:
110+
files: dist/*
111+
token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)