Skip to content

Commit 78a2bc7

Browse files
author
John Jeffers
authored
Merge pull request #103 from FusionAuth/jj/release-workflow
add release workflow
2 parents 96c9a8a + 0415c1e commit 78a2bc7

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed

.github/workflows/deploy.yaml

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
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 npmjs
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/npmjs \
69+
--query SecretString \
70+
--output text | \
71+
jq -r 'to_entries[] | [.key, .value] | @tsv')
72+
73+
- name: create npmrc
74+
run: |
75+
echo "color=false" > ~/.npmrc
76+
echo "//registry.npmjs.org/:_authToken=${{ env.API_KEY }}" >> ~/.npmrc
77+
chmod 600 ~/.npmrc
78+
79+
- name: release to svn
80+
if: inputs.command == 'release'
81+
shell: bash -l {0}
82+
run: sb release
83+
84+
- name: publish to npmjs
85+
if: inputs.command == 'publish'
86+
shell: bash -l {0}
87+
run: sb publish

0 commit comments

Comments
 (0)