Bump league/commonmark from 2.5.3 to 2.6.0 (#60) #348
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "🏗️ Build and deploy" | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
run-tests: | |
name: "🧪 Run tests" | |
runs-on: ubuntu-20.04 | |
services: | |
mysql: | |
image: mysql:8.0 | |
env: | |
MYSQL_ROOT_PASSWORD: root | |
MYSQL_DATABASE: mondegc_testing | |
ports: | |
- 3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Checkout full repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Detect secrets | |
uses: gitleaks/gitleaks-action@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITLEAKS_NOTIFY_USER_LIST: '@Roxayl' | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.1' | |
extensions: curl, gd, iconv, json, mbstring, pdo, pdo_mysql, zip | |
- name: Install PHP dependencies | |
run: composer install -q --no-ansi --no-interaction --no-progress | |
- name: Initialize environment and database | |
env: | |
DB_HOST: 127.0.0.1 | |
DB_PASSWORD: root | |
DB_DATABASE: mondegc_testing | |
DB_PORT: ${{ job.services.mysql.ports['3306'] }} | |
run: | | |
chmod -R 777 storage bootstrap/cache | |
php artisan monde:init-env | |
php artisan monde:init-testing | |
php artisan migrate -v | |
- name: Execute unit and feature tests via PHPUnit | |
env: | |
DB_HOST: 127.0.0.1 | |
DB_PASSWORD: root | |
DB_DATABASE: mondegc_testing | |
DB_PORT: ${{ job.services.mysql.ports['3306'] }} | |
run: php artisan test | |
run-backups: | |
name: "💾 Run backups" | |
runs-on: ubuntu-20.04 | |
needs: run-tests | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Backup user files and database | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.PROD_SSH_HOST }} | |
port: ${{ secrets.PROD_SSH_PORT }} | |
username: ${{ secrets.PROD_SSH_USERNAME }} | |
password: ${{ secrets.PROD_SSH_PASSWORD }} | |
script_stop: true | |
script: | | |
cd "${{ vars.PROD_FULL_DIR }}" | |
php artisan backup:run | |
deploy-to-prod: | |
name: "🚀 Deploy to production" | |
runs-on: ubuntu-20.04 | |
needs: run-backups | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Prepare deployment | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.PROD_SSH_HOST }} | |
port: ${{ secrets.PROD_SSH_PORT }} | |
username: ${{ secrets.PROD_SSH_USERNAME }} | |
password: ${{ secrets.PROD_SSH_PASSWORD }} | |
script: | | |
cd "${{ vars.PROD_FULL_DIR }}" | |
php artisan down --refresh=60 --retry=60 | |
- name: Deploy sources | |
uses: SamKirkland/[email protected] | |
with: | |
protocol: ftps | |
server: ${{ secrets.PROD_SSH_HOST }} | |
port: ${{ secrets.PROD_FTP_PORT }} | |
username: ${{ secrets.PROD_SSH_USERNAME }} | |
password: ${{ secrets.PROD_SSH_PASSWORD }} | |
local-dir: ./ | |
server-dir: ${{ vars.PROD_FTP_DIR }} | |
exclude: | | |
**/.git* | |
**/.git*/** | |
**/node_modules/** | |
log-level: standard | |
- name: Cleanup deployment | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.PROD_SSH_HOST }} | |
port: ${{ secrets.PROD_SSH_PORT }} | |
username: ${{ secrets.PROD_SSH_USERNAME }} | |
password: ${{ secrets.PROD_SSH_PASSWORD }} | |
script: | | |
cd "${{ vars.PROD_FULL_DIR }}" | |
composer install --no-dev --classmap-authoritative --no-ansi --no-interaction --no-progress | |
BUILD_NUMBER=${{ github.run_number }} | |
find ./.env -type f -exec sed -i '' -e "/^APP_BUILD=/s/=.*/=\'$BUILD_NUMBER\'/" {} \; | |
php artisan optimize:clear | |
php artisan migrate --force | |
php artisan monde:generate-htaccess | |
php artisan monde:regenerate-influences | |
php artisan scribe:generate | |
php artisan up |