-
Notifications
You must be signed in to change notification settings - Fork 12
138 lines (130 loc) · 5.44 KB
/
Copy pathpreview-host.yml
File metadata and controls
138 lines (130 loc) · 5.44 KB
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
name: Preview Host
on:
pull_request:
paths:
- "packages/host/**"
- "packages/boxel-ui/**"
- "packages/boxel-icons/**"
- ".github/workflows/pr-boxel-host.yml"
- ".github/workflows/preview-host.yml"
- "package.json"
- "pnpm-lock.yaml"
concurrency:
group: preview-host-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
issues: write
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
concurrency:
group: check-if-requires-preview-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
outputs:
boxel-host-files-changed: ${{ steps.boxel-host-files-that-changed.outputs.any_changed }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Get boxel-host files that changed
id: boxel-host-files-that-changed
uses: tj-actions/changed-files@2f7c5bfce28377bc069a65ba478de0a74aa0ca32 # 46.0.1
with:
files: |
.github/workflows/build-host.yml
.github/workflows/deploy-host.yml
.github/workflows/pr-boxel-host.yml
.github/workflows/preview-host.yml
packages/host/**
packages/boxel-ui/**
packages/boxel-icons/**
deploy-host-preview-staging:
name: Deploy a boxel-host 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-host-files-changed == 'true'
needs: check-if-requires-preview
concurrency:
group: deploy-host-preview-staging-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0
with:
role-to-assume: arn:aws:iam::680542703984:role/boxel-host
aws-region: us-east-1
- name: Load app environment variables
shell: bash
run: cat packages/host/config/staging.env >> $GITHUB_ENV
- name: Deploy boxel-host preview
uses: ./.github/actions/deploy-ember-preview
env:
S3_PREVIEW_BUCKET_NAME: boxel-host-preview.stack.cards
AWS_S3_BUCKET: boxel-host-preview.stack.cards
AWS_REGION: us-east-1
AWS_CLOUDFRONT_DISTRIBUTION: EU4RGLH4EOCHJ
with:
package: boxel-host
environment: staging
deploy-host-preview-production:
name: Deploy a boxel-host 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-host-files-changed == 'true'
needs: check-if-requires-preview
concurrency:
group: deploy-host-preview-production-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@ec61189d14ec14c8efccab744f656cffd0e33f37 # v6.1.0
with:
role-to-assume: arn:aws:iam::120317779495:role/boxel-host
aws-region: us-east-1
- name: Load app environment variables
shell: bash
run: cat packages/host/config/production.env >> $GITHUB_ENV
- name: Deploy boxel-host preview
uses: ./.github/actions/deploy-ember-preview
env:
S3_PREVIEW_BUCKET_NAME: boxel-host-preview.boxel.ai
AWS_S3_BUCKET: boxel-host-preview.boxel.ai
AWS_REGION: us-east-1
AWS_CLOUDFRONT_DISTRIBUTION: E2PZR9CIAW093B
with:
package: boxel-host
environment: production
post-preview-comment:
name: Update preview comment
needs:
- deploy-host-preview-staging
- deploy-host-preview-production
if: ${{ !cancelled() && (needs.deploy-host-preview-staging.result == 'success' || needs.deploy-host-preview-production.result == 'success') }}
uses: ./.github/workflows/preview-comment.yml
with:
head-sha: ${{ github.event.pull_request.head.sha }}
secrets: inherit
post-pr-status:
name: Update PR status comment
needs:
- post-preview-comment
if: ${{ !cancelled() && needs.post-preview-comment.result == 'success' && needs.post-preview-comment.outputs.slots != '' }}
uses: ./.github/workflows/pr-status-comment.yml
permissions:
contents: read
issues: write
pull-requests: write
actions: read
with:
head-sha: ${{ github.event.pull_request.head.sha }}
pr-number: ${{ github.event.pull_request.number }}
slots: ${{ needs.post-preview-comment.outputs.slots }}
secrets: inherit