-
Notifications
You must be signed in to change notification settings - Fork 5
49 lines (46 loc) · 1.52 KB
/
deploy-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
49
name: Deploy to S3
on:
workflow_dispatch:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.repository }}/${{ github.ref }}
cancel-in-progress: true
env:
NODE_VERSION: 16.15.1
CACHE_WEB_NAME: web
jobs:
deploy:
name: Deploy Website to S3
runs-on: ubuntu-20.04
steps:
- name: Git checkout
uses: actions/checkout@v3
- name: Use Node.js ${{ env.NODE_VERSION }}
uses: actions/[email protected]
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache web dependencies
id: web-cache
uses: actions/cache@v3
with:
path: node_modules
key: ${{ runner.OS }}-${{ env.CACHE_WEB_NAME }}-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
if: steps.web-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Compile & build
run: npm run build
- name: Deploy to S3
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-central-1
run: aws s3 cp --recursive dist s3://taskana.pro
- name: Invalidate AWS CloudFront Cache
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: eu-central-1
run: aws cloudfront create-invalidation --distribution-id=${{ secrets.DISTRIBUTION_ID }} --paths /