Merge branch 'release/2.0.3' #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Keeper Production Client | |
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy_production: | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 10 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18" | |
cache: "npm" | |
- name: Create Env File | |
run: | | |
touch .env | |
echo "${{ secrets.ENV_PROD }}" >> .env | |
- name: Cache node_modules | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Build | |
run: CI= npm run build | |
- name: Compress | |
run: tar -zcf ${GITHUB_SHA::8}.tar.gz build | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
- name: Upload to S3 | |
run: | | |
aws s3 mv --region ap-northeast-2 \ | |
${GITHUB_SHA::8}.tar.gz \ | |
${{ secrets.S3_PROD_FRONT_LOCATION }}/${GITHUB_SHA::8}.tar.gz | |
- name: Sync to S3 | |
run: | | |
aws s3 sync build ${{ secrets.S3_PROD_FRONT_DEPLOYMENT }} \ | |
--delete | |
- name: Invalidate CloudFront Cache | |
run: | | |
aws cloudfront create-invalidation \ | |
--distribution-id ${{ secrets.CLOUDFRONT_PROD_DISTRIBUTION_ID }} \ | |
--paths "/*" | |
- name: Notify Slack | |
if: always() | |
uses: 8398a7/action-slack@v3 | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
with: | |
status: ${{ job.status }} | |
author_name: Keeper Production Frontend CICD | |
fields: repo, commit, message, author, action, took |