diff --git a/.github/workflows/python-app.yml b/.github/workflows/python-app.yml index 948e93d..636eccd 100644 --- a/.github/workflows/python-app.yml +++ b/.github/workflows/python-app.yml @@ -5,6 +5,7 @@ on: branches: ["main"] pull_request: branches: ["**"] + workflow_call: # Allow this workflow to be called by other workflows permissions: contents: read @@ -76,4 +77,29 @@ jobs: uses: codecov/codecov-action@v5 with: token: ${{ secrets.CODECOV_TOKEN }} - slug: DrWheelicus/encoderize \ No newline at end of file + slug: DrWheelicus/encoderize + + build_package: + runs-on: ubuntu-latest + needs: lint_and_test + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + + - name: Install build dependencies + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build package + run: python -m build + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6fb4b35 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +name: Release to PyPI + +on: + push: + tags: + - "v*" + +permissions: + contents: write + id-token: write + +jobs: + # Reuse the existing CI workflow for testing and building + ci: + uses: ./.github/workflows/python-app.yml + secrets: inherit + + publish-pypi: + needs: ci + runs-on: ubuntu-latest + environment: + name: Main Deployment + url: https://pypi.org/project/encoderize/ + steps: + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + github-release: + needs: [ci, publish-pypi] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Download build artifacts + uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + files: dist/*