merge(feature/prices branch) #2038
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 dev | |
on: | |
push: | |
branches: | |
- dev | |
env: | |
BUCKET_NAME: app-dev.nolus.io | |
CLOUDFRONT_ID: E2LBZO2KACZIF | |
AWS_REGION: eu-west-1 | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
jobs: | |
build: | |
name: Build static files | |
runs-on: ubuntu-latest | |
container: node:20.9.0 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: | | |
npm install | |
npm run build | |
- name: Archive src | |
uses: actions/upload-artifact@v3 | |
with: | |
name: src | |
path: dist/ | |
deploy: | |
name: Deploy to AWS | |
runs-on: ubuntu-20.04 | |
container: amazon/aws-cli | |
environment: development | |
needs: build | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Download src | |
uses: actions/download-artifact@v3 | |
with: | |
name: src | |
path: dist/ | |
- name: Sync bucket | |
run: | | |
aws s3 sync dist/ s3://${BUCKET_NAME} | |
invalidate-cache: | |
name: Invalidate cache | |
runs-on: ubuntu-20.04 | |
container: amazon/aws-cli | |
environment: development | |
needs: deploy | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ env.AWS_REGION }} | |
- name: Invalidate cloudfront cache | |
run: | | |
aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths "/*" --output table | |
echo "Cache invalidation usually takes a couple of minutes" |