Add imprint #56
Workflow file for this run
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Deploy AWS | |
on: | |
- push | |
- pull_request | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: 🚚 Get latest code | |
uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- name: 🔨 Build Project | |
run: | | |
npm install | |
npm run build:ci | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: teuto_map_artifact | |
path: build | |
retention-days: 30 | |
deploy-dev: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: build | |
environment: aws_dev | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: teuto_map_artifact | |
path: build_artifact | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: eu-central-1 | |
role-to-assume: ${{ secrets.DEPLOY_ROLE }} | |
- name: 📂 Sync files to S3 | |
run: aws s3 sync ./build_artifact/ s3://${{ secrets.S3_BUCKET }} --delete | |
- name: Invalidate Cloudfront Cache | |
run: aws cloudfront create-invalidation --distribution-id=${{ secrets.DISTRIBUTION_ID }} --paths / | |
deploy-prod: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- deploy-dev | |
environment: aws_prod | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: teuto_map_artifact | |
path: build_artifact | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-region: eu-central-1 | |
role-to-assume: ${{ secrets.DEPLOY_ROLE }} | |
- name: 📂 Sync files to S3 | |
run: aws s3 sync ./build_artifact/ s3://${{ secrets.S3_BUCKET }} --delete | |
- name: Invalidate Cloudfront Cache | |
run: aws cloudfront create-invalidation --distribution-id=${{ secrets.DISTRIBUTION_ID }} --paths / |