Skip to content

Commit

Permalink
created publish pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: Melvin Strobl <[email protected]>
  • Loading branch information
Melvin Strobl committed Sep 27, 2024
1 parent a112db6 commit f613d33
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Publish
on:
release:
types: [published]
workflow_dispatch:
push:
branches: [ "main" ]
permissions:
contents: write
jobs:
Expand All @@ -18,9 +17,10 @@ jobs:
uses: ./.github/workflows/docs.yml
with:
test-run-id: ${{ github.run_id }}
deploy:
needs: [quality, test]
name: Deployment
release:
needs: [test, quality, documentation]
name: Release
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -31,13 +31,27 @@ jobs:
with:
python-version: "3.11"
cache: 'poetry'
- name: Install dependencies
run: poetry install --with dev
- name: Publish with Poetry
- name: Compare tag and version
run: |
if [ "$(git tag)" = "$(poetry version --short)" ]; then
echo "The tag and the version are the same, nothing to do."
echo "DORELEASE=false" >> $GITHUB_ENV
else
echo "DORELEASE=true" >> $GITHUB_ENV
fi
- name: Create Release & Tag
if: env.DORELEASE == 'true'
run: |
poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
poetry build
poetry publish


gh release create "$(poetry version --short)" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} $(poetry version --short)" \
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Publish to PyPI
# if: env.DORELEASE == 'true'
# run: |
# poetry install --with dev
# poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }}
# poetry build
# poetry publish

0 comments on commit f613d33

Please sign in to comment.