Install poetry then cache #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish | |
on: | |
push: | |
branches: | |
- release | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Upgrade pip | |
run: | | |
pip install pip | |
pip --version | |
- name: Install Poetry | |
run: | | |
pip install poetry | |
poetry --version | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
cache: 'poetry' | |
- name: Install dependencies | |
run: poetry install --no-interaction | |
- name: Build wheel | |
run: poetry build | |
- name: Run Tests | |
run: poetry run pytest | |
- name: Generate release tag | |
id: tag | |
run: echo "release_tag=$(git rev-parse HEAD | head -c 8)" >> $GITHUB_OUTPUT | |
- name: Upload Release Asset | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tag.outputs.release_tag }} | |
files: dist/*.whl | |
draft: false | |
prerelease: false | |
- name: Remove other releases | |
uses: sgpublic/delete-release-action@v1.1 | |
with: | |
release-drop: true | |
release-keep-count: 2 | |
release-drop-tag: false | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |