Skip to content

Commit

Permalink
Add deployment preview workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
backspace committed Mar 21, 2024
1 parent efcf478 commit 2acb4df
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/pr-boxel-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI [boxel-ui]

on:
pull_request:
paths:
- "packages/boxel-ui/**"
- ".github/workflows/pr-boxel-ui.yml"
- "package.json"
- "pnpm-lock.yaml"

permissions:
contents: read
issues: read
checks: write
pull-requests: write
id-token: write
statuses: write

jobs:
check-if-requires-preview:
name: Check if a preview deploy is required
runs-on: ubuntu-latest
outputs:
boxel-ui-files-changed: ${{ steps.boxel-ui-files-that-changed.outputs.any_changed }}
steps:
- uses: actions/checkout@v3
- name: Get boxel-ui files that changed
id: boxel-ui-files-that-changed
uses: tj-actions/changed-files@v39
with:
files: |
packages/boxel-ui/**
deploy-ui-preview-staging:
name: Deploy a boxel-ui staging preview to S3
runs-on: ubuntu-latest
# github.event.pull_request.head.repo.full_name == github.repository: true if pr is from the original repo, false if it's from a fork
# github.head_ref: the branch that the pull request is from. only appears on pull_request events
if: github.event.pull_request.head.repo.full_name == github.repository && github.head_ref && needs.check-if-requires-preview.outputs.boxel-ui-files-changed == 'true'
needs: check-if-requires-preview
concurrency: deploy-ui-preview-staging
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::680542703984:role/boxel-ui
aws-region: us-east-1
- name: Deploy boxel-ui preview
uses: ./.github/actions/deploy-ember-preview
env:
S3_PREVIEW_BUCKET_NAME: boxel-ui-preview.stack.cards
AWS_S3_BUCKET: boxel-ui-preview.stack.cards
AWS_REGION: us-east-1
AWS_CLOUDFRONT_DISTRIBUTION: E3Q2MVA30QSVUH
with:
package: boxel-ui
environment: staging

deploy-ui-preview-production:
name: Deploy a boxel-ui production preview to S3
runs-on: ubuntu-latest
# github.event.pull_request.head.repo.full_name == github.repository: true if pr is from the original repo, false if it's from a fork
# github.head_ref: the branch that the pull request is from. only appears on pull_request events
if: github.event.pull_request.head.repo.full_name == github.repository && github.head_ref && needs.check-if-requires-preview.outputs.boxel-ui-files-changed == 'true'
needs: check-if-requires-preview
concurrency: deploy-ui-preview-production
steps:
- uses: actions/checkout@v3
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v3
with:
role-to-assume: arn:aws:iam::120317779495:role/boxel-host
aws-region: us-east-1
- name: Deploy boxel-ui preview
uses: ./.github/actions/deploy-ember-preview
env:
S3_PREVIEW_BUCKET_NAME: boxel-ui-preview.cardstack.com
AWS_S3_BUCKET: boxel-ui-preview.cardstack.com
AWS_REGION: us-east-1
# FIXME incorrect
AWS_CLOUDFRONT_DISTRIBUTION: E1JS2AYUPFW775
with:
package: boxel-ui
environment: production
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"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",
"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",
"deploy:boxel-ui": "cd packages/boxel-ui/addon && pnpm build && cd ../test-app && pnpm exec ember deploy",
"deploy:boxel-ui:preview-staging": "cd packages/boxel-ui/addon && pnpm build && cd ../test-app && pnpm exec ember deploy s3-preview-staging --verbose",
"deploy:boxel-ui:preview-production": "cd packages/boxel-ui/addon && pnpm build && cd ../test-app && pnpm exec ember deploy s3-preview-production --verbose",
"lint": "pnpm run --filter './packages/**' --if-present -r lint",
"lint:fix": "pnpm run --filter './packages/**' --if-present -r lint:fix"
},
Expand Down

0 comments on commit 2acb4df

Please sign in to comment.