-
Notifications
You must be signed in to change notification settings - Fork 15
31 lines (29 loc) · 1.08 KB
/
deploy-staging.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
name: CD
on:
push:
branches: [ staging ]
env:
NEXT_PUBLIC_BASE_PATH: ''
NEXT_PUBLIC_DOCSEARCH_APP_ID: ${{ secrets.NEXT_PUBLIC_DOCSEARCH_APP_ID }}
NEXT_PUBLIC_DOCSEARCH_API_KEY: ${{ secrets.NEXT_PUBLIC_DOCSEARCH_API_KEY }}
NEXT_PUBLIC_DOCSEARCH_INDEX_NAME: ${{ secrets.NEXT_PUBLIC_DOCSEARCH_INDEX_NAME }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 18
- run: npm ci
- id: files
uses: jitterbit/get-changed-files@v1
- run: npm run test -- --filesToCheck=${{ steps.files.outputs.added_modified }}
- run: npm run build
- uses: aws-actions/configure-aws-credentials@v2
with:
aws-access-key-id: ${{ secrets.AWS_S3_STAGE_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_S3_STAGE_SECRET }}
aws-region: eu-west-1
- run: aws s3 sync ./build ${{ secrets.AWS_S3_STAGE_PATH }} --delete
- run: aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_DISTRIBUTION_STAGE }} --paths '/*'