From c2c251e8877bc1cd764e12c38902b67d8400eecd Mon Sep 17 00:00:00 2001 From: Michael Vogelsong Date: Fri, 6 May 2022 14:15:35 -0700 Subject: [PATCH] Add github action for publishing on releases --- .github/workflows/publish.yaml | 36 ++++++++++++++++++++++++++++++++++ README.md | 4 +--- pyproject.toml | 2 +- 3 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..0ee9e0d1 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,36 @@ +# When a release is created on github, publish the groundlight package to our internal pypi repository +# (Similar to https://github.com/positronix-ai/predictors/blob/main/.github/workflows/publish.yaml) +name: publish package +on: + release: + types: [created] +jobs: + publish-python-package: + runs-on: ubuntu-latest + env: + INTERNAL_REPO_URL: https://positronix-723181461334.d.codeartifact.us-west-2.amazonaws.com/pypi/internal/ + steps: + - name: install python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: install poetry + run: | + pip install -U pip + pip install poetry + - name: configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: us-west-2 + - name: get code + uses: actions/checkout@v2 + - name: build package + run: poetry build + - name: configure poetry and publish + run: | + export POETRY_HTTP_BASIC_INTERNAL_USERNAME=aws + export POETRY_HTTP_BASIC_INTERNAL_PASSWORD=$(aws codeartifact get-authorization-token --domain positronix --query authorizationToken --output text) + poetry config repositories.internal $INTERNAL_REPO_URL + poetry publish -r internal diff --git a/README.md b/README.md index bc45abe7..6f8b8aa0 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ except ApiException as e: ## Development -To re-generate the client code: +The auto-generated SDK code is in the `generated/` directory. To re-generate the client code: ```Bash $ make generate @@ -77,8 +77,6 @@ $ make generate ## TODOs - Tests -- Publish package (so we can do `pip install groundlight` or `poetry add groundlight` outside this repo) - - Do it through github actions on tag, for example - Improve wrappers around API functions (e.g., so you don't have to call `.body` on a response, or add auto-pagination managers, etc.) - `with` context manager - Better auto-generated code docs diff --git a/pyproject.toml b/pyproject.toml index 227da2c1..b50710ef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "groundlight" -version = "0.1.1" +version = "0.1.2" description = "Call the Groundlight API from python" authors = ["Groundlight AI "] packages = [