Skip to content

Commit 1ab0fbe

Browse files
committed
wip
1 parent 9f2acbd commit 1ab0fbe

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/deploy.yaml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
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 maven
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: compile
42+
shell: bash -l {0}
43+
run: sb compile
44+
45+
deploy:
46+
if: |
47+
github.event_name == 'workflow_dispatch' &&
48+
(inputs.command == 'release' || inputs.command == 'publish')
49+
runs-on: fusionauth-builder
50+
steps:
51+
- name: checkout
52+
uses: actions/checkout@v4
53+
54+
- name: set aws credentials
55+
uses: aws-actions/configure-aws-credentials@v4
56+
with:
57+
role-to-assume: arn:aws:iam::752443094709:role/github-actions
58+
role-session-name: aws-auth-action
59+
aws-region: us-west-2
60+
61+
- name: get secret
62+
run: |
63+
while IFS=$'\t' read -r key value; do
64+
echo "::add-mask::${value}"
65+
echo "${key}=${value}" >> $GITHUB_ENV
66+
done < <(aws secretsmanager get-secret-value \
67+
--region us-west-2 \
68+
--secret-id platform/maven \
69+
--query SecretString \
70+
--output text | \
71+
jq -r 'to_entries[] | [.key, .value] | @tsv')
72+
73+
- name: import gpg key
74+
run: |
75+
export GPG_TTY=$(tty)
76+
echo "${{ env.PRIVATE_KEY_B64 }}" | base64 -d > /tmp/key.asc
77+
echo "${{ env.PASSWORD }}" | gpg --batch --yes --passphrase-fd 0 --import /tmp/key.asc
78+
rm /tmp/key.asc
79+
80+
- name: release to svn
81+
shell: bash -l {0}
82+
run: devsetup -o maven -n
83+
84+
# - name: release to svn
85+
# if: inputs.command == 'release'
86+
# shell: bash -l {0}
87+
# run: sb release
88+
89+
# - name: publish to maven
90+
# if: inputs.command == 'publish'
91+
# shell: bash -l {0}
92+
# run: sb publish

0 commit comments

Comments
 (0)