Skip to content

Commit b664176

Browse files
committed
Add preliminary UI deployment
1 parent 4b42538 commit b664176

File tree

5 files changed

+137
-3
lines changed

5 files changed

+137
-3
lines changed

.github/workflows/deploy-ui.yml

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Deploy boxel-ui with ember
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
environment:
7+
required: true
8+
type: string
9+
10+
permissions:
11+
contents: read
12+
id-token: write
13+
14+
jobs:
15+
deploy:
16+
name: Deploy
17+
runs-on: ubuntu-latest
18+
concurrency: deploy-ui-${{ inputs.environment }}
19+
steps:
20+
- uses: actions/checkout@v3
21+
22+
- name: Init
23+
uses: ./.github/actions/init
24+
25+
- name: Set up env
26+
env:
27+
INPUT_ENVIRONMENT: ${{ inputs.environment }}
28+
run: |
29+
echo "AWS_REGION=us-east-1" >> $GITHUB_ENV
30+
if [ "$INPUT_ENVIRONMENT" = "production" ]; then
31+
echo "AWS_ROLE_ARN=arn:aws:iam::120317779495:role/boxel-ui" >> $GITHUB_ENV
32+
echo "AWS_S3_BUCKET=cardstack-boxel-ui-production" >> $GITHUB_ENV
33+
echo "AWS_CLOUDFRONT_DISTRIBUTION=E2DDEHLJXF5LQ8" >> $GITHUB_ENV
34+
elif [ "$INPUT_ENVIRONMENT" = "staging" ]; then
35+
echo "AWS_ROLE_ARN=arn:aws:iam::680542703984:role/boxel-ui" >> $GITHUB_ENV
36+
echo "AWS_S3_BUCKET=cardstack-boxel-ui-staging" >> $GITHUB_ENV
37+
echo "AWS_CLOUDFRONT_DISTRIBUTION=E1RYJDFNHAI7XA" >> $GITHUB_ENV
38+
else
39+
echo "unrecognized environment"
40+
exit 1;
41+
fi
42+
# FIXME production distribution is incorrect
43+
- name: Download dist
44+
uses: actions/download-artifact@v3
45+
with:
46+
name: ui-dist
47+
path: packages/ui/tmp/deploy-dist
48+
49+
- name: Configure AWS credentials
50+
uses: aws-actions/configure-aws-credentials@v3
51+
with:
52+
role-to-assume: ${{ env.AWS_ROLE_ARN }}
53+
aws-region: us-east-1
54+
55+
- name: Deploy
56+
run: pnpm deploy:boxel-ui ${{ inputs.environment }} --verbose
57+
env:
58+
EMBER_CLI_DEPLOY_REUSE_BUILD: "1"
59+
60+
- name: Send notification to Discord
61+
uses: cardstack/gh-actions/discord-notification-deploy@main
62+
with:
63+
app: "boxel-ui"
64+
status: ${{ job.status }}
65+
environment: ${{ inputs.environment }}
66+
webhook: ${{ secrets.DISCORD_WEBHOOK }}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"deploy:boxel-host": "cd packages/boxel-ui/addon && pnpm build && cd ../../host && BASE_REALM_HOSTING_DISABLED=true NODE_OPTIONS='--max_old_space_size=8192' pnpm exec ember deploy",
1111
"deploy:boxel-host:preview-staging": "cd packages/boxel-ui/addon && pnpm build && cd ../../host && BASE_REALM_HOSTING_DISABLED=true NODE_OPTIONS='--max_old_space_size=8192' pnpm exec ember deploy s3-preview-staging --verbose",
1212
"deploy:boxel-host:preview-production": "cd packages/boxel-ui/addon && pnpm build && cd ../../host && BASE_REALM_HOSTING_DISABLED=true NODE_OPTIONS='--max_old_space_size=8192' pnpm exec ember deploy s3-preview-production --verbose",
13+
"deploy:boxel-ui": "cd packages/boxel-ui/addon && pnpm build && cd ../test-app && pnpm exec ember deploy",
1314
"lint": "pnpm run --filter './packages/**' --if-present -r lint",
1415
"lint:fix": "pnpm run --filter './packages/**' --if-present -r lint:fix"
1516
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* eslint-env node */
2+
3+
module.exports = function (deployTarget) {
4+
let ENV = {
5+
pipeline: {
6+
activateOnDeploy: true,
7+
},
8+
plugins: ['build', 'smart-compress', 'revision-data', 's3', 'cloudfront'],
9+
build: {},
10+
s3: {
11+
allowOverwrite: true,
12+
bucket: process.env.AWS_S3_BUCKET,
13+
region: process.env.AWS_REGION,
14+
filePattern: '**/*',
15+
},
16+
cloudfront: {
17+
objectPaths: ['/*'],
18+
distribution: process.env.AWS_CLOUDFRONT_DISTRIBUTION,
19+
},
20+
};
21+
22+
if (deployTarget === 'staging') {
23+
ENV.build.environment = 'production';
24+
}
25+
26+
if (deployTarget === 'production') {
27+
ENV.build.environment = 'production';
28+
}
29+
30+
if (deployTarget === 'build-only') {
31+
ENV.build.environment = 'production';
32+
ENV.plugins = ['build'];
33+
}
34+
35+
if (
36+
deployTarget === 's3-preview-staging' ||
37+
deployTarget === 's3-preview-production'
38+
) {
39+
ENV.s3.prefix = process.env.PR_BRANCH_NAME;
40+
}
41+
42+
return ENV;
43+
};

packages/boxel-ui/test-app/package.json

+6
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@
5656
"ember-auto-import": "^2.6.3",
5757
"ember-cli": "^4.12.1",
5858
"ember-cli-babel": "^8.2.0",
59+
"ember-cli-deploy": "^1.0.2",
60+
"ember-cli-deploy-build": "^2.0.0",
61+
"ember-cli-deploy-cloudfront": "^5.0.0",
62+
"ember-cli-deploy-revision-data": "^2.0.0",
63+
"ember-cli-deploy-s3": "^3.1.0",
64+
"ember-cli-deploy-smart-compress": "^2.0.0",
5965
"ember-cli-dependency-checker": "^3.3.1",
6066
"ember-cli-htmlbars": "^6.3.0",
6167
"ember-cli-inject-live-reload": "^2.1.0",

pnpm-lock.yaml

+21-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)