From 516caf7baa182ef8424c4b2049b7baeae5adea72 Mon Sep 17 00:00:00 2001 From: Joe Date: Wed, 29 May 2024 15:32:45 -0500 Subject: [PATCH] ci: Add github action (#15) Fixes #13 Add a github action to publish a new version by pushing a tag --- .github/requirements.txt | 2 ++ .github/workflows/build.yml | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/requirements.txt create mode 100644 .github/workflows/build.yml diff --git a/.github/requirements.txt b/.github/requirements.txt new file mode 100644 index 0000000..97123c7 --- /dev/null +++ b/.github/requirements.txt @@ -0,0 +1,2 @@ +build +wheel diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a86decd --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,37 @@ +name: Build + +on: + pull_request: + branches: [ main ] + push: + branches: [ main ] + tags: [ 'v*' ] + +jobs: + build: + runs-on: ubuntu-22.04 + permissions: + id-token: write + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: '3.10' + cache: 'pip' + cache-dependency-path: '.github/requirements.txt' + + - name: Install Python dependencies + run: pip install -r .github/requirements.txt + + - name: Build wheel + run: python -m build + + - uses: actions/upload-artifact@v3 + with: + name: dist + path: dist/ + if-no-files-found: error + + - uses: pypa/gh-action-pypi-publish@release/v1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')