From 45a8e18277eed7642d61c9798cf0d3412ea85732 Mon Sep 17 00:00:00 2001 From: John Jeffers Date: Thu, 6 Jun 2024 19:39:55 -0600 Subject: [PATCH 1/3] add deploy workflow --- .github/workflows/deploy.yaml | 111 ++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..d40f13c --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,111 @@ +# Run locally with act: +# +# act pull_request [--input command=[command]] \ +# --platform fusionauth-builder=[ecr-repo-name]/fusionauth-builder:latest] \ +# --workflows ./.github/workflows/release.yaml \ +# --env-file <(aws configure export-credentials --profile [aws-profile] --format env) + +name: Deploy + +on: + push: + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + inputs: + command: + type: choice + options: + - build # build only + - publish # build & publish to rubygems + - release # build & release to svn + default: build + +permissions: + contents: read + +jobs: + build: + if: | + github.event_name == 'pull_request' || + github.event_name == 'push' || + github.event_name == 'workflow_dispatch' && inputs.command == 'build' + runs-on: fusionauth-builder + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: setup python + shell: bash -l {0} + run: | + echo 'PYTHON_VERSIONS=("3.8.13")' > ~/dev/inversoft/fusionauth/fusionauth-developer/.env + echo 'ACTIVE_PYTHON="3.8.13"' >> ~/dev/inversoft/fusionauth/fusionauth-developer/.env + ~/dev/inversoft/fusionauth/fusionauth-developer/setup.sh -o python + + - name: compile + shell: bash -l {0} + run: sb compile + + deploy: + if: | + github.event_name == 'workflow_dispatch' && + (inputs.command == 'release' || inputs.command == 'publish') + runs-on: fusionauth-builder + steps: + - name: checkout + uses: actions/checkout@v4 + + - name: set aws credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::752443094709:role/github-actions + role-session-name: aws-auth-action + aws-region: us-west-2 + + - name: get secret + run: | + while IFS=$'\t' read -r key value; do + echo "::add-mask::${value}" + echo "${key}=${value}" >> $GITHUB_ENV + done < <(aws secretsmanager get-secret-value \ + --region us-west-2 \ + --secret-id platform/pypi \ + --query SecretString \ + --output text | \ + jq -r 'to_entries[] | [.key, .value] | @tsv') + + - name: set pypi credentials + run: | + cat << EOF > ~/.pypirc + [distutils] + index-servers = + pypi + fusionauth-client + [pypi] + username = __token__ + password = ${{ env.API_KEY }} + [fusionauth-client] + repository = https://upload.pypi.org/legacy/ + username = __token__ + password = ${{ env.API_KEY }} + EOF + + - name: setup python + shell: bash -l {0} + run: | + echo 'PYTHON_VERSIONS=("3.8.13")' > ~/dev/inversoft/fusionauth/fusionauth-developer/.env + echo 'ACTIVE_PYTHON="3.8.13"' >> ~/dev/inversoft/fusionauth/fusionauth-developer/.env + ~/dev/inversoft/fusionauth/fusionauth-developer/setup.sh -o python + + - name: release to svn + if: inputs.command == 'release' + shell: bash -l {0} + run: sb release + + - name: publish to pypi + if: inputs.command == 'publish' + shell: bash -l {0} + run: sb publish From dca5d0eb8eeb85de3cefa0885582aca7aa879acf Mon Sep 17 00:00:00 2001 From: John Jeffers Date: Thu, 6 Jun 2024 21:28:55 -0600 Subject: [PATCH 2/3] remove python install from workflow, update package metadata --- .github/workflows/deploy.yaml | 14 -------------- setup.py | 11 ++++++----- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index d40f13c..09fb32e 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -38,13 +38,6 @@ jobs: - name: checkout uses: actions/checkout@v4 - - name: setup python - shell: bash -l {0} - run: | - echo 'PYTHON_VERSIONS=("3.8.13")' > ~/dev/inversoft/fusionauth/fusionauth-developer/.env - echo 'ACTIVE_PYTHON="3.8.13"' >> ~/dev/inversoft/fusionauth/fusionauth-developer/.env - ~/dev/inversoft/fusionauth/fusionauth-developer/setup.sh -o python - - name: compile shell: bash -l {0} run: sb compile @@ -93,13 +86,6 @@ jobs: password = ${{ env.API_KEY }} EOF - - name: setup python - shell: bash -l {0} - run: | - echo 'PYTHON_VERSIONS=("3.8.13")' > ~/dev/inversoft/fusionauth/fusionauth-developer/.env - echo 'ACTIVE_PYTHON="3.8.13"' >> ~/dev/inversoft/fusionauth/fusionauth-developer/.env - ~/dev/inversoft/fusionauth/fusionauth-developer/setup.sh -o python - - name: release to svn if: inputs.command == 'release' shell: bash -l {0} diff --git a/setup.py b/setup.py index 497f23e..b89eb81 100644 --- a/setup.py +++ b/setup.py @@ -6,15 +6,15 @@ setup( name="fusionauth-client", version="1.51.0", - author="Tyler Scott", + author="FusionAuth", author_email="dev@fusionauth.io", description="A client library for FusionAuth", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/FusionAuth/fusionauth-python-client", - packages=find_packages(where='src/main/python'), + packages=find_packages(where="src/main/python"), namespace_packages=["fusionauth"], - package_dir={'': 'src/main/python'}, + package_dir={"": "src/main/python"}, classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: Apache Software License", @@ -22,6 +22,7 @@ "Topic :: Software Development :: Libraries", ], install_requires=[ - 'deprecated', 'requests', - ] + "deprecated", + "requests", + ], ) From d5d12e5b98322d56b0c57961bd8eb34595d3faf8 Mon Sep 17 00:00:00 2001 From: John Jeffers Date: Thu, 6 Jun 2024 22:38:56 -0600 Subject: [PATCH 3/3] fix comment --- .github/workflows/deploy.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index 09fb32e..11d5acc 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -20,7 +20,7 @@ on: type: choice options: - build # build only - - publish # build & publish to rubygems + - publish # build & publish to pypi - release # build & release to svn default: build