Skip to content

Templates Theme / Component Refactore #1472

Templates Theme / Component Refactore

Templates Theme / Component Refactore #1472

Workflow file for this run

on:
pull_request:
branches:
- main
- develop
- templates
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
Tests:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repositiory
uses: actions/checkout@v2
- name: Set Github Credentials
run: |
git config user.name searchspring-machine
git config user.email [email protected]
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 20
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install packages
run: npm ci
- name: Build
run: npm run build
- name: Eslint
run: npm run lint
- name: Tests
env:
NODE_OPTIONS: "--max-old-space-size=4096"
run: npm run test
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.SNAPFU_AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.SNAPFU_AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- name: Copy Files to S3
shell: bash
run: |
aws s3 sync --acl public-read packages/snap-preact-demo/snap/dist s3://${{ secrets.SNAPFU_AWS_BUCKET }}/snap/${{ github.head_ref }}
aws s3 sync --acl public-read packages/snap-preact-demo/public/snap s3://${{ secrets.SNAPFU_AWS_BUCKET }}/snap/${{ github.head_ref }}
aws s3 sync --acl public-read packages/snap-preact-demo/templates/dist s3://${{ secrets.SNAPFU_AWS_BUCKET }}/templates/${{ github.head_ref }}
aws s3 sync --acl public-read packages/snap-preact-demo/public/templates s3://${{ secrets.SNAPFU_AWS_BUCKET }}/templates/${{ github.head_ref }}
- name: Invalidate CDN Files
shell: bash
env:
AWS_MAX_ATTEMPTS: 9
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.SNAPFU_AWS_DISTRIBUTION_ID }} --paths "/snap/${{ github.head_ref }}/*"
aws cloudfront create-invalidation --distribution-id ${{ secrets.SNAPFU_AWS_DISTRIBUTION_ID }} --paths "/templates/${{ github.head_ref }}/*"