Facebook
From Harmless Zebra, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 60
  1. name: Deploy to the Staging enviroment
  2.  
  3. on:
  4.   push:
  5.     branches: [ development ]
  6.  
  7. jobs:
  8.   deploy-stage:
  9.     name: deploy
  10.     runs-on: ubuntu-latest
  11.     strategy:
  12.       matrix:
  13.         node-version: [12.x]
  14.     steps:
  15.     - uses: actions/checkout@v2
  16.  
  17.     - uses: actions/setup-node@v1
  18.       with:
  19.         node-version: ${{ matrix.node-version }}
  20.     - run: npm ci
  21.  
  22.     - uses: shivammathur/setup-php@v2
  23.       with:
  24.         php-version: "7.4"
  25.  
  26.     - uses: aws-actions/configure-aws-credentials@v1
  27.       with:
  28.         aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
  29.         aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  30.         aws-region: us-west-2
  31.  
  32.     - uses: "ramsey/composer-install@v1"
  33.       with:
  34.         composer-options: "--prefer-dist --optimize-autoloader --no-dev --no-scripts"
  35.  
  36.     - name: Build front-end assets
  37.       run: npm run prod
  38.        
  39.     - name: Upload front-end assets
  40.       run: aws s3 sync public/ ${{ secrets.S3_STAGE_ASSETS_BUCKET }} --delete --exclude index.php
  41.  
  42.     - name: Clear cache and enviroment
  43.       run: php artisan optimize:clear
  44.  
  45.     - name: Create .env file
  46.       run: |
  47.         cat > .env <<EOF
  48.         ${{ secrets.STAGING }}
  49.         EOF
  50.  
  51.     - name: Optimize Composer autoloader
  52.       run: composer dump-autoload -o
  53.  
  54.     - name: Deploy
  55.       uses: serverless/github-action@master
  56.       with:
  57.         args: deploy
  58.  
  59.     - name: Run migrations
  60.       run: vendor/bin/bref cli FSmart-Stage-dev-artisan --region us-west-2 -- migrate
  61.  
  62.     - name: Invalidate Cloudfront cache
  63.       run: aws cloudfront create-invalidation --distribution-id E1C297PZD4PUWT --paths "/*"