Skip to content

Commit f613d33

Browse files
author
Melvin Strobl
committed
created publish pipeline
Signed-off-by: Melvin Strobl <lc3267@kit.edu>
1 parent a112db6 commit f613d33

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

.github/workflows/publish.yml

+29-15
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Publish
22
on:
3-
release:
4-
types: [published]
5-
workflow_dispatch:
3+
push:
4+
branches: [ "main" ]
65
permissions:
76
contents: write
87
jobs:
@@ -18,9 +17,10 @@ jobs:
1817
uses: ./.github/workflows/docs.yml
1918
with:
2019
test-run-id: ${{ github.run_id }}
21-
deploy:
22-
needs: [quality, test]
23-
name: Deployment
20+
release:
21+
needs: [test, quality, documentation]
22+
name: Release
23+
if: github.ref == 'refs/heads/main'
2424
runs-on: ubuntu-latest
2525
steps:
2626
- uses: actions/checkout@v4
@@ -31,13 +31,27 @@ jobs:
3131
with:
3232
python-version: "3.11"
3333
cache: 'poetry'
34-
- name: Install dependencies
35-
run: poetry install --with dev
36-
- name: Publish with Poetry
34+
- name: Compare tag and version
35+
run: |
36+
if [ "$(git tag)" = "$(poetry version --short)" ]; then
37+
echo "The tag and the version are the same, nothing to do."
38+
echo "DORELEASE=false" >> $GITHUB_ENV
39+
else
40+
echo "DORELEASE=true" >> $GITHUB_ENV
41+
fi
42+
- name: Create Release & Tag
43+
if: env.DORELEASE == 'true'
3744
run: |
38-
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
39-
poetry build
40-
poetry publish
41-
42-
43-
45+
gh release create "$(poetry version --short)" \
46+
--repo="$GITHUB_REPOSITORY" \
47+
--title="${GITHUB_REPOSITORY#*/} $(poetry version --short)" \
48+
--generate-notes
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
# - name: Publish to PyPI
52+
# if: env.DORELEASE == 'true'
53+
# run: |
54+
# poetry install --with dev
55+
# poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
56+
# poetry build
57+
# poetry publish

0 commit comments

Comments
 (0)