Skip to content

Commit

Permalink
Update deployment actions
Browse files Browse the repository at this point in the history
  • Loading branch information
campos20 committed Jun 17, 2024
1 parent 4ee752c commit 8c30d9b
Showing 1 changed file with 13 additions and 26 deletions.
39 changes: 13 additions & 26 deletions .github/workflows/frontdeploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,44 +13,31 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: actions/cache@v2
uses: actions/cache@v3
with:
path: "**/client/node_modules"
key: ${{ runner.os }}-modules-${{ hashFiles('**/client/yarn.lock') }}
key: ${{ runner.os }}-v2-${{ hashFiles('**/client/package-lock.json') }}

- name: Use Node.js 14
uses: actions/setup-node@v2
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "14"
node-version: "21.x"

- name: Yarn Install
- name: Install dependencies
working-directory: ./client
run: yarn install
run: npm install
- name: Production build
working-directory: ./client
run: yarn build
env:
REACT_APP_BASE_URL: ${{ secrets.REACT_APP_BASE_URL }}
PUBLIC_URL: ${{ secrets.PUBLIC_URL }}
- name: Unit Tests
run: npm run build
- name: Synchronize files
working-directory: ./client
run: yarn test
- name: Deploy to S3
uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --delete
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.CI_CD_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_CD_AWS_SECRET_ACCESS_KEY }}
AWS_REGION: us-west-2
SOURCE_DIR: "client/build"
- name: Create cloudfront invalidation
run: |
export AWS_ACCESS_KEY_ID=${{ secrets.CI_CD_AWS_ACCESS_KEY_ID }}
export AWS_SECRET_ACCESS_KEY=${{ secrets.CI_CD_AWS_SECRET_ACCESS_KEY }}
export AWS_DEFAULT_REGION=${{ secrets.AWS_DEFAULT_REGION }}
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths '/*'
aws configure set preview.cloudfront true
aws s3 sync dist ${{ secrets.AWS_S3_BUCKET }} --delete
aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths /\*

0 comments on commit 8c30d9b

Please sign in to comment.