Skip to content

Commit 819b7a5

Browse files
committed
chore: update GitHub Actions workflow to use 'development' branch and add tagging step
1 parent 9ca4f00 commit 819b7a5

File tree

1 file changed

+33
-6
lines changed

1 file changed

+33
-6
lines changed

.github/workflows/build.yml

+33-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
name: Build and Test
1+
name: Test and Tag
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main, development ]
66
pull_request:
7-
branches: [ main, develop ]
7+
branches: [ main, development ]
88
release:
99
types: [created]
1010

@@ -26,7 +26,7 @@ jobs:
2626
- name: Install dependencies
2727
run: |
2828
python -m pip install --upgrade pip
29-
pip install build pytest pytest-cov ruff
29+
pip install build pytest pytest-cov ruff toml
3030
pip install -r requirements.txt
3131
pip install -e .
3232
@@ -41,11 +41,32 @@ jobs:
4141
- name: Build package
4242
run: python -m build
4343

44+
create-tag:
45+
needs: test
46+
runs-on: ubuntu-latest
47+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/development')
48+
49+
steps:
50+
- uses: actions/checkout@v3
51+
52+
- name: Get version from pyproject.toml
53+
id: get_version
54+
run: |
55+
version=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
56+
echo "version=$version" >> $GITHUB_OUTPUT
57+
58+
- name: Create and push tag
59+
run: |
60+
git config --local user.email "[email protected]"
61+
git config --local user.name "GitHub Action"
62+
git tag -a "v${{ steps.get_version.outputs.version }}" -m "Release v${{ steps.get_version.outputs.version }}"
63+
git push origin "v${{ steps.get_version.outputs.version }}"
64+
4465
publish:
4566
needs: test
4667
runs-on: ubuntu-latest
4768
if: github.event_name == 'release' && github.event.action == 'created'
48-
69+
4970
steps:
5071
- uses: actions/checkout@v3
5172

@@ -57,8 +78,14 @@ jobs:
5778
- name: Install dependencies
5879
run: |
5980
python -m pip install --upgrade pip
60-
pip install build twine
81+
pip install build pytest pytest-cov ruff twine
82+
pip install -r requirements.txt
83+
pip install -e .
6184
85+
- name: Run tests
86+
run: |
87+
pytest --cov
88+
6289
- name: Build package
6390
run: python -m build
6491

0 commit comments

Comments
 (0)