-
Notifications
You must be signed in to change notification settings - Fork 18
48 lines (40 loc) · 1.56 KB
/
deploy-pr-to-s3.yml
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
# This workflow takes care of deploying the pull request in an isolated environment for a better QA experience.
name: Deploy the pull request to AWS S3
on: [pull_request]
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO_NAME: ${{ github.event.repository.name }}
jobs:
deploy-to-s3:
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
steps:
- name: Checkout 🚪
uses: actions/checkout@v2
with:
persist-credentials: false
- name: Read .nvmrc 🔍
run: echo "::set-output name=NODE_VERSION::$(cat .nvmrc)"
id: nvm
- name: Set up the right node version 📌
uses: actions/setup-node@v1
with:
node-version: ${{ steps.nvm.outputs.NODE_VERSION }}
- name: Install dependencies ⚙️
run: npm ci
- name: Build 📦
run: npm run build:storybook -- -o ./dist/${{ env.REPO_NAME }}/${{ env.PR_NUMBER }}
- name: Deploy 🚀
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_PR_DEPLOYMENT_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
SOURCE_DIR: 'dist'
- name: Add comment 💬
uses: marocchino/[email protected]
with:
message: |
🚀 This PR has been deployed here: https://frontend-pulls.homeday.de/${{ env.REPO_NAME }}/${{ env.PR_NUMBER }}/