-
Notifications
You must be signed in to change notification settings - Fork 12
97 lines (86 loc) · 2.57 KB
/
deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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