Checkout repo and setup python #14
Workflow file for this run
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 deploy | |
on: | |
push: | |
branches: | |
- main | |
- master | |
paths: | |
- 'src/**' | |
tags: | |
- '[0-9]+.[0-9]+.[0-9]+' | |
workflow_dispatch: | |
jobs: | |
test-deploy: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Test package | |
run: | | |
pip install -e . | |
pip install pytest | |
pytest | |
pypi-publish: | |
if: startsWith(github.ref, 'refs/tags') | |
runs-on: ubuntu-latest | |
needs: | |
- test-deploy | |
permissions: | |
id-token: write | |
environment: | |
name: pypi | |
url: https://pypi.org/p/lifefit | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v2 | |
- name: Setup python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
- name: Build package | |
run: | | |
pip install build | |
python -m build | |
- name: Upload dists | |
uses: actions/upload-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
- name: Retrieve release distributions | |
uses: actions/download-artifact@v4 | |
with: | |
name: release-dists | |
path: dist/ | |
- name: Publish release distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |