From 392de91a4e54afadcee6db7e020526b206fabb0e Mon Sep 17 00:00:00 2001 From: KrijnL Date: Fri, 23 Aug 2024 10:58:11 +0200 Subject: [PATCH] feat: add CI workflow --- .github/workflows/deploy.yml | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..bc7ae31 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,62 @@ +name: "Build and Deploy" +on: + push: + branches: + - main + + pull_request: + types: + - opened + - synchronize + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + Build: + runs-on: ubuntu-latest + timeout-minutes: 15 + strategy: + matrix: + include: + - name: dashboard-filter-panel + outputFolder: dist/dashboard-filter-panel/browser/ + - name: drag-n-drop-chart-library + outputFolder: build/ + - name: report-builder + outputFolder: dist/report-builder/browser/ + - name: wearables-dashboard + outputFolder: dist/ + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup node + uses: actions/setup-node@v3 + + - name: Cache node modules + uses: actions/cache@v2 + with: + path: ${{ matrix.name }}/node_modules + key: ${{ runner.os }}-node-${{ matrix.name }}-${{ hashFiles(format('{0}/{1}', matrix.name, 'package-lock.json')) }} + + - name: Build front end + run: | + cd ${{ matrix.name }} + npm ci + npm run build:ci + + - name: Upload to S3 + uses: shallwefootball/s3-upload-action@master + # if: github.event_name != 'pull_request' + with: + aws_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY}} + aws_bucket: "showcases.luzmo.com" + source_dir: ${{ matrix.name }}/${{ matrix.outputFolder }} + destination_dir: ${{ matrix.name }} + + # Invalidate Cloudfront: +