From 0cdd1b593bb7db0ad1bae9421534039da1fbe132 Mon Sep 17 00:00:00 2001 From: Marius Date: Thu, 24 Oct 2024 14:31:46 +0200 Subject: [PATCH] chore: Add workflow to publish autopilot-utils to PyPI --- .../workflows/publish-autopilot-utils.yaml | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/publish-autopilot-utils.yaml diff --git a/.github/workflows/publish-autopilot-utils.yaml b/.github/workflows/publish-autopilot-utils.yaml new file mode 100644 index 00000000..78b82fbb --- /dev/null +++ b/.github/workflows/publish-autopilot-utils.yaml @@ -0,0 +1,61 @@ +name: Publish Autopilot Utils to PyPI + +on: + workflow_dispatch: + push: + branches: + - add-autopilot-utils-publish-workflow + +env: + PYTHON_APPS_FOLDER: yaku-apps-python + +jobs: + build-package: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + sparse-checkout: ${{ env.PYTHON_APPS_FOLDER }} + + - name: Put all files from ${{ env.PYTHON_APPS_FOLDER }} in cwd + run: | + mv ${{ env.PYTHON_APPS_FOLDER }}/* . + + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Setup pants + uses: pantsbuild/actions/init-pants@v8 + with: + gha-cache-key: cache0 + named-caches-hash: ${{ hashFiles('/3rdparty/*.txt') }} + + - name: Build wheel + run: | + pants package ./packages/autopilot-utils/:: + + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: autopilot-utils-package-distributions + path: dist/*.whl + + + publish-to-pypi: + runs-on: ubuntu-latest + needs: [build-package] + env: + name: pypi + url: https://pypi.org/p/autopilot-utils + permissions: + id-token: write + steps: + - name: Download distribution packages + uses: actions/download-artifact@v4 + with: + name: autopilot-utils-package-distributions + path: dist/ + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 \ No newline at end of file