Skip to content

2.3.12 - Maintained Marid #297

2.3.12 - Maintained Marid

2.3.12 - Maintained Marid #297

Workflow file for this run

on:
release:
types: [released]
workflow_dispatch:
name: Deploy master branch
jobs:
deploy_master:
name: Deploy Master
runs-on: ubuntu-latest
services:
mysql:
image: mariadb:10.3
env:
MYSQL_DATABASE: test_database
MYSQL_HOST: 127.0.0.1
MYSQL_USER: admin
MYSQL_PASSWORD: rootpass
MYSQL_ROOT_PASSWORD: rootpass
ports:
- 3306:3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
steps:
- uses: actions/checkout@v2
with:
token: ${{ secrets.GH_CHECKOUT_TOKEN }}
submodules: 'recursive'
- uses: actions/cache@v3
id: cache-npm
with:
path: |
./node_modules/
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- uses: actions/cache@v3
id: cache-assets
with:
path: |
./public
key: ${{ runner.os }}-${{ hashFiles('**/resources') }}
- uses: actions/cache@v3
id: cache-composer
with:
path: |
./vendor/
key: ${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
- uses: actions/cache@v3
id: cache-env
with:
path: |
./.env
key: ${{ runner.os }}-${{ hashFiles('**/.env.github') }}
- uses: actions/setup-node@v2
with:
node-version: '20'
- uses: "shivammathur/setup-php@v2"
with:
php-version: "8.1"
- uses: "ramsey/composer-install@v2"
- name: Create env file
run: |
php -r "file_exists('.env') || copy('.env.github', '.env');"
- name: Create env file
run: |
cat > .env << EOF
APP_ENV=production
EOF
- name: Generate app_key
run: php artisan key:generate
# - name: Run unit tests
# run: php artisan test
- name: Actions Status Discord
if: ${{ failure() }}
uses: sarisia/[email protected]
with:
webhook: ${{ secrets.DISCORD_FC_BETA_WEBHOOK }}
description: 'Unit tests failed'
username: "Github"
avatar_url: "https://beta.fantasy-calendar.com//resources/header_logo.png"
title: "Deploy failure"
color: 0xdc2626
nodetail: true
- uses: "ramsey/composer-install@v2"
with:
composer-options: "--prefer-dist --optimize-autoloader --no-dev --ignore-platform-reqs"
- name: Configure AWS Credentials
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-east-1
- name: Install NPM dependencies
run: npm install --legacy-peer-deps
- name: Build production assets
run: npm run production
- name: Copy assets into S3
run: |
aws s3 sync ./public s3://fantasy-calendar-prod/
- name: Deploy to prod
run: npx serverless@3 deploy --stage prod
- name: Actions Status Discord
uses: sarisia/[email protected]
with:
webhook: ${{ secrets.DISCORD_FC_BETA_WEBHOOK }}
description: "A new version of Fantasy Calendar has been deployed"
username: "Github"
avatar_url: "https://beta.fantasy-calendar.com//resources/header_logo.png"
title: "Deploy success"
nodetail: true
- name: Discord release notification
if: "!github.event.release.prerelease"
env:
DISCORD_WEBHOOK: ${{ secrets.RELEASE_WEBHOOK }}
DISCORD_USERNAME: ${{github.event.release.name}}
uses: Ilshidur/action-discord@master
with:
args: "${{github.event.release.body}}"