pyproject: Add README.md #9
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: CI | |
on: [push, pull_request] | |
jobs: | |
test: | |
name: Test y4 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install Python prerequisites | |
run: | | |
pip install pytest | |
- name: Install y4 from checkout | |
run: | | |
pip install . | |
- name: Run y4 pytests | |
run: | | |
pytest tests/ | |
build: | |
name: Build source package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install hatch | |
run: | | |
pip install hatch | |
- name: Building using hatch | |
run: | | |
hatch build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: packages | |
path: dist/y4-*.tar.gz | |
deploy: | |
name: Publish release | |
runs-on: ubuntu-latest | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
needs: build | |
steps: | |
- name: Fetch artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: packages | |
path: artifact | |
- name: Prepare dist/ directory | |
run: | | |
mkdir dist/ | |
# Get exactly the version that we want to publish. | |
version="$(grep -Po '(?<=^refs/tags/v).+$' <<< "$ref")" | |
mv "artifact/y4-$version.tar.gz" dist/ | |
env: | |
ref: ${{ github.ref }} | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |