Skip to content

Commit 45a8e18

Browse files
committed
add deploy workflow
1 parent 88ebe3b commit 45a8e18

1 file changed

Lines changed: 111 additions & 0 deletions

File tree

.github/workflows/deploy.yaml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# Run locally with act:
2+
#
3+
# act pull_request [--input command=[command]] \
4+
# --platform fusionauth-builder=[ecr-repo-name]/fusionauth-builder:latest] \
5+
# --workflows ./.github/workflows/release.yaml \
6+
# --env-file <(aws configure export-credentials --profile [aws-profile] --format env)
7+
8+
name: Deploy
9+
10+
on:
11+
push:
12+
branches:
13+
- main
14+
pull_request:
15+
branches:
16+
- main
17+
workflow_dispatch:
18+
inputs:
19+
command:
20+
type: choice
21+
options:
22+
- build # build only
23+
- publish # build & publish to rubygems
24+
- release # build & release to svn
25+
default: build
26+
27+
permissions:
28+
contents: read
29+
30+
jobs:
31+
build:
32+
if: |
33+
github.event_name == 'pull_request' ||
34+
github.event_name == 'push' ||
35+
github.event_name == 'workflow_dispatch' && inputs.command == 'build'
36+
runs-on: fusionauth-builder
37+
steps:
38+
- name: checkout
39+
uses: actions/checkout@v4
40+
41+
- name: setup python
42+
shell: bash -l {0}
43+
run: |
44+
echo 'PYTHON_VERSIONS=("3.8.13")' > ~/dev/inversoft/fusionauth/fusionauth-developer/.env
45+
echo 'ACTIVE_PYTHON="3.8.13"' >> ~/dev/inversoft/fusionauth/fusionauth-developer/.env
46+
~/dev/inversoft/fusionauth/fusionauth-developer/setup.sh -o python
47+
48+
- name: compile
49+
shell: bash -l {0}
50+
run: sb compile
51+
52+
deploy:
53+
if: |
54+
github.event_name == 'workflow_dispatch' &&
55+
(inputs.command == 'release' || inputs.command == 'publish')
56+
runs-on: fusionauth-builder
57+
steps:
58+
- name: checkout
59+
uses: actions/checkout@v4
60+
61+
- name: set aws credentials
62+
uses: aws-actions/configure-aws-credentials@v4
63+
with:
64+
role-to-assume: arn:aws:iam::752443094709:role/github-actions
65+
role-session-name: aws-auth-action
66+
aws-region: us-west-2
67+
68+
- name: get secret
69+
run: |
70+
while IFS=$'\t' read -r key value; do
71+
echo "::add-mask::${value}"
72+
echo "${key}=${value}" >> $GITHUB_ENV
73+
done < <(aws secretsmanager get-secret-value \
74+
--region us-west-2 \
75+
--secret-id platform/pypi \
76+
--query SecretString \
77+
--output text | \
78+
jq -r 'to_entries[] | [.key, .value] | @tsv')
79+
80+
- name: set pypi credentials
81+
run: |
82+
cat << EOF > ~/.pypirc
83+
[distutils]
84+
index-servers =
85+
pypi
86+
fusionauth-client
87+
[pypi]
88+
username = __token__
89+
password = ${{ env.API_KEY }}
90+
[fusionauth-client]
91+
repository = https://upload.pypi.org/legacy/
92+
username = __token__
93+
password = ${{ env.API_KEY }}
94+
EOF
95+
96+
- name: setup python
97+
shell: bash -l {0}
98+
run: |
99+
echo 'PYTHON_VERSIONS=("3.8.13")' > ~/dev/inversoft/fusionauth/fusionauth-developer/.env
100+
echo 'ACTIVE_PYTHON="3.8.13"' >> ~/dev/inversoft/fusionauth/fusionauth-developer/.env
101+
~/dev/inversoft/fusionauth/fusionauth-developer/setup.sh -o python
102+
103+
- name: release to svn
104+
if: inputs.command == 'release'
105+
shell: bash -l {0}
106+
run: sb release
107+
108+
- name: publish to pypi
109+
if: inputs.command == 'publish'
110+
shell: bash -l {0}
111+
run: sb publish

0 commit comments

Comments
 (0)