name: Deploy to the Staging enviroment
on:
push:
branches: [ development ]
jobs:
deploy-stage:
name: deploy
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- uses: shivammathur/setup-php@v2
with:
php-version: "7.4"
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-west-2
- uses: "ramsey/composer-install@v1"
with:
composer-options: "--prefer-dist --optimize-autoloader --no-dev --no-scripts"
- name: Build front-end assets
run: npm run prod
- name: Upload front-end assets
run: aws s3 sync public/ ${{ secrets.S3_STAGE_ASSETS_BUCKET }} --delete --exclude index.php
- name: Clear cache and enviroment
run: php artisan optimize:clear
- name: Create .env file
run: |
cat > .env <<EOF
${{ secrets.STAGING }}
EOF
- name: Optimize Composer autoloader
run: composer dump-autoload -o
- name: Deploy
uses: serverless/github-action@master
with:
args: deploy
- name: Run migrations
run: vendor/bin/bref cli FSmart-Stage-dev-artisan --region us-west-2 -- migrate
- name: Invalidate Cloudfront cache
run: aws cloudfront create-invalidation --distribution-id E1C297PZD4PUWT --paths "/*"
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}