Skip to content

Commit

Permalink
Merge pull request #26 from FusionAuth/jj/release-workflow
Browse files Browse the repository at this point in the history
add deploy workflow
  • Loading branch information
johnjeffers committed Jun 7, 2024
2 parents 88ebe3b + d5d12e5 commit 70992f6
Show file tree
Hide file tree
Showing 2 changed files with 103 additions and 5 deletions.
97 changes: 97 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# 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 pypi
- 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: 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: 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
11 changes: 6 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,23 @@
setup(
name="fusionauth-client",
version="1.51.0",
author="Tyler Scott",
author="FusionAuth",
author_email="[email protected]",
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",
"Operating System :: OS Independent",
"Topic :: Software Development :: Libraries",
],
install_requires=[
'deprecated', 'requests',
]
"deprecated",
"requests",
],
)

0 comments on commit 70992f6

Please sign in to comment.