From 0defda6213edfe4e1f56d893bd80872df96432ca Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Sat, 21 Sep 2024 09:23:08 +0200 Subject: [PATCH] Update pipelines (#154) --- .github/workflows/docs.yml | 34 +++++++++++++++ .github/workflows/publish.yml | 79 ++++++++++++++++++++--------------- docs/CNAME | 1 + 3 files changed, 81 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/docs.yml create mode 100644 docs/CNAME diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 0000000..c600001 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,34 @@ +name: Deploy Documentation + +on: + push: + tags: + - "**" + +permissions: + contents: write + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Configure Git Credentials + run: | + git config user.name github-actions[bot] + git config user.email 41898282+github-actions[bot]@users.noreply.github.com + + - name: Install uv + uses: astral-sh/setup-uv@v2 + with: + version: "0.4.12" + enable-cache: true + + - name: Set up Python + run: uv python install 3.12 + + - name: Install dependencies + run: uv sync --frozen + + - run: uv run mkdocs gh-deploy --force diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 82b3ef5..2d12eb3 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,46 +1,59 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries - -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package +name: Publish Python Package on: push: tags: - - '*' - -permissions: - contents: read + - "**" jobs: - deploy: + build: runs-on: ubuntu-latest - + outputs: + version: ${{ steps.inspect_package.outputs.version }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Python 3.10 - uses: actions/setup-python@v5 - with: - python-version: "3.10" + - name: Install uv + uses: astral-sh/setup-uv@v2 + with: + version: "0.4.12" + enable-cache: true + + - name: Set up Python + run: uv python install 3.12 + + - name: Build package + run: uv build - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build - pip install -e '.[docs]' + - name: Inspect package version + id: inspect_package + run: | + version=$(uvx hatchling version) + echo "version=$version" >> "$GITHUB_OUTPUT" - - name: Build package - run: python -m build + - name: Upload package + uses: actions/upload-artifact@v4 + with: + name: package-distributions + path: dist/ - - name: Publish package - uses: pypa/gh-action-pypi-publish@v1.8.14 + pypi-publish: + runs-on: ubuntu-latest + needs: build + + permissions: + id-token: write + + environment: + name: pypi + url: https://pypi.org/project/python-multipart/${{ needs.build.outputs.version }} + + steps: + - name: Download package + uses: actions/download-artifact@v4 with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} - - name: Publish docs - run: mkdocs gh-deploy --force + name: package-distributions + path: dist/ + + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000..c1cab6e --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +multipart.fastapiexpert.com