2021-04-17 04:47:21 +00:00
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
2021-05-07 21:52:28 +00:00
name : build
2021-04-25 22:56:23 +00:00
on : [ push, pull_request ]
2021-04-17 04:47:21 +00:00
jobs :
2021-04-25 22:56:23 +00:00
test :
runs-on : ubuntu-latest
strategy :
matrix :
2024-04-16 07:02:09 +00:00
python-version : [ "3.8" , "3.9" , "3.10" , "3.11" , "3.12" ]
2024-08-08 07:50:19 +00:00
click-version : [ "click~=8.0" ]
2021-04-25 22:56:23 +00:00
steps :
2024-04-16 07:03:35 +00:00
- uses : actions/checkout@v4
2021-04-25 22:56:23 +00:00
- name : Set up Python ${{ matrix.python-version }}
2024-07-11 06:39:33 +00:00
uses : actions/setup-python@v5.1.1
2021-04-25 22:56:23 +00:00
with :
python-version : ${{ matrix.python-version }}
2021-04-17 04:47:21 +00:00
2021-04-25 22:56:23 +00:00
- name : Install dependencies
run : |
python -m pip install --upgrade pip
python -m pip install flake8
2021-05-12 05:21:09 +00:00
python -m pip install ${{ matrix.click-version }}
2021-04-25 22:56:23 +00:00
- name : Lint with flake8
run : |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
2024-08-22 05:39:25 +00:00
- name : Install module
run : python -m pip install .
2024-08-22 05:35:32 +00:00
- name : Run Unit Tests
2021-04-30 06:34:01 +00:00
run : python -m unittest -v
2021-04-25 22:56:23 +00:00
2024-08-22 05:35:32 +00:00
- name : Run Action
id : yaclog-show
uses : ./
2021-04-25 22:56:23 +00:00
deploy :
2024-08-22 05:39:25 +00:00
needs : test
2021-04-17 04:47:21 +00:00
runs-on : ubuntu-latest
2024-08-22 05:39:51 +00:00
if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
2024-08-27 06:30:05 +00:00
environment :
name : pypi
url : https://pypi.org/p/yaclog
permissions :
id-token : write
2024-08-27 08:03:09 +00:00
contents : write
2021-04-17 04:47:21 +00:00
steps :
2024-04-16 07:02:09 +00:00
- uses : actions/checkout@v4
2021-04-17 04:47:21 +00:00
- name : Set up Python
2024-07-11 06:39:33 +00:00
uses : actions/setup-python@v5.1.1
2021-04-17 04:47:21 +00:00
with :
2024-04-16 07:02:09 +00:00
python-version : '>=3.8'
2021-04-17 04:47:21 +00:00
- name : Install pypa/build
run : python -m pip install build --user
- name : Build a binary wheel and source tarball
run : python -m build --sdist --wheel --outdir dist/
2024-08-27 06:30:05 +00:00
- name : Get Changelog Information
2024-08-20 07:28:48 +00:00
id : yaclog-show
uses : ./
2024-08-27 06:30:05 +00:00
# self-hosting!
2021-04-30 06:34:01 +00:00
2021-04-17 04:47:21 +00:00
- name : Publish to PyPI
uses : pypa/gh-action-pypi-publish@release/v1
2021-04-30 06:34:01 +00:00
- name : Publish to Github
2024-08-25 03:29:44 +00:00
run : |
gh release create ${{ github.ref_name }} \
--notes-file "${{ steps.yaclog-show.outputs.body_file }}" \
--title "${{ steps.yaclog-show.outputs.name }}"
gh release upload ${{ github.ref_name }} dist/*
2021-04-30 06:34:01 +00:00
env :
2024-08-25 03:29:44 +00:00
GH_TOKEN : ${{ github.token }}