Skip to content

Merge pull request #17 #44

Merge pull request #17

Merge pull request #17 #44

Workflow file for this run

name: Publish
on:
push:
tags:
- "v*.*.*"
workflow_dispatch:
env:
PYTHON_VERSION: 3.11.0
POETRY_VERSION: 1.3.1
jobs:
wait_static_tests:
name: Wait for Static Tests
runs-on: ubuntu-latest
strategy:
matrix:
test: [ "Flake8", "mypy" ]
python: [ "3.11", "3.10", "3.9" ]
steps:
- uses: actions/checkout@v4
- name: Wait for Tests
id: wait
uses: fountainhead/action-wait-for-check@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: "${{ matrix.test }} (${{ matrix.python }})"
ref: ${{ github.event.push_request.head.sha || github.sha }}
- if: ${{ steps.wait.outputs.conclusion != 'success' }}
run: exit 1
wait_unit_tests:
name: Wait for Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Wait for Tests
id: wait
uses: fountainhead/action-wait-for-check@v1.0.0
with:
token: ${{ secrets.GITHUB_TOKEN }}
checkName: "pytest"
ref: ${{ github.event.push_request.head.sha || github.sha }}
- if: ${{ steps.wait.outputs.conclusion != 'success' }}
run: exit 1
publish:
name: Publish
runs-on: ubuntu-latest
needs: [ wait_static_tests, wait_unit_tests ]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: abatilo/actions-poetry@v2.0.0
with:
poetry-version: ${{ env.POETRY_VERSION }}
- name: Build and publish
env:
PYPI_USERNAME: __token__
PYPI_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
poetry config virtualenvs.in-project true
poetry install --no-root
poetry publish --build --username $PYPI_USERNAME --password $PYPI_PASSWORD
- name: Save dist
uses: actions/upload-artifact@v4
with:
name: dist
path: dist
# release:
# name: Release
# runs-on: ubuntu-latest
# needs: publish
# steps:
# - uses: actions/checkout@v4
# with:
# fetch-depth: 0
# - name: Get dist
# uses: actions/download-artifact@v4
# with:
# name: dist
# path: dist
# - name: Get Tag
# id: tag
# uses: olegtarasov/get-tag@v2.1.1
# - name: Clean CHANGELOG.md
# run: |
# touch CHANGELOG.md.tmp
# npm install -g prettier
# prettier --parser markdown --tab-width 4 --prose-wrap never CHANGELOG.md > CHANGELOG.md.tmp
# cat CHANGELOG.md.tmp > CHANGELOG.md
# - name: Build Release
# id: release
# uses: MatteoCampinoti94/changelog-to-release@v1.0.2
# with:
# version-name: ${{ steps.tag.outputs.tag }}
# - name: Build Release File
# env:
# TAG: ${{ steps.tag.outputs.tag }}
# RELEASE: ${{ steps.release.outputs.body }}
# run: |
# touch RELEASE.md
# PREVIOUS_TAG="$(git tag -l --sort=-version:refname | head -2 | tail -1)"
# printf "%s\n" "$RELEASE" > RELEASE.md
# printf "\n## 🔗 Links\n" >> RELEASE.md
# printf "\n* %s" "PyPi release: https://pypi.org/project/${GITHUB_REPOSITORY#*/}/${TAG#v}" >> RELEASE.md
# printf "\n* %s" "Full changelog: https://github.com/$GITHUB_REPOSITORY/compare/$PREVIOUS_TAG...$TAG" >> RELEASE.md
# cat RELEASE.md
# printf "\n\n## Dist Files\n"
# ls -l dist || echo " no files"
# - name: Create Release
# uses: softprops/action-gh-release@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# tag_name: ${{ steps.tag.outputs.tag }}
# name: ${{ steps.release.outputs.title }}
# body_path: RELEASE.md
# files: |
# dist/*