Skip to content

Commit 43c42f5

Browse files
committed
Add release automation github action
Signed-off-by: Rahul Krishna <[email protected]>
1 parent 36daf8d commit 43c42f5

File tree

2 files changed

+65
-4
lines changed

2 files changed

+65
-4
lines changed

.github/workflows/python-publish.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,4 @@ jobs:
4949

5050
- name: Publish package distributions to PyPI
5151
run: poetry publish --username $PYPI_USERNAME --password $PYPI_PASSWORD
52-
53-
- name: Publish documentation
54-
run: pip install mkdocs-material
55-
run: mkdocs gh-deploy --force
52+

.github/workflows/release.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Python Poetry Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Python
20+
uses: actions/setup-python@v4
21+
with:
22+
python-version: '3.11'
23+
24+
- name: Install Poetry
25+
run: |
26+
curl -sSL https://install.python-poetry.org | python3 -
27+
echo "${HOME}/.local/bin" >> $GITHUB_PATH
28+
29+
- name: Configure Poetry
30+
run: poetry config virtualenvs.in-project true
31+
32+
- name: Install Dependencies
33+
run: poetry install --no-root
34+
35+
- name: Run Tests
36+
id: build
37+
continue-on-error: true # Allow workflow continuation on failure
38+
run: poetry run make test
39+
40+
- name: Delete tag on failure
41+
if: steps.build.outcome != 'success'
42+
run: |
43+
git push --delete origin ${GITHUB_REF#refs/tags/}
44+
exit 1 # Fail the workflow
45+
46+
- name: Build Package
47+
run: poetry build
48+
49+
- name: Build Changelog
50+
id: gen_changelog
51+
uses: mikepenz/release-changelog-builder-action@v5
52+
with:
53+
failOnError: "true"
54+
configuration: .github/workflows/release_config.json
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
58+
- name: Publish Release on GitHub
59+
uses: softprops/action-gh-release@v1
60+
with:
61+
files: dist/*
62+
body: ${{ steps.gen_changelog.outputs.changelog }}
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)