65. regenerate phpstan baseline #853
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: Production | |
on: | |
push: | |
branches: [ master ] | |
repository_dispatch: | |
types: [ retry-* ] | |
workflow_dispatch: | |
inputs: | |
deploy_params: | |
description: 'Deploy params' | |
default: "-vvv" | |
type: string | |
concurrency: | |
group: ${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
laravel-tests-and-deploy: | |
runs-on: ubuntu-20.04 | |
environment: production | |
defaults: | |
run: | |
working-directory: ./src | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '8.3' | |
- uses: actions/checkout@v3 | |
- uses: symfonycorp/security-checker-action@v3 | |
with: | |
lock: src/composer.lock | |
- name: Copy .env | |
run: php -r "file_exists('.env') || copy('.env.example', '.env');" | |
- name: Install composer dependencies | |
run: composer install --optimize-autoloader --no-dev --quiet | |
- name: Generate key | |
run: php artisan key:generate | |
- name: Directory Permissions | |
run: chmod -R 777 storage bootstrap/cache | |
- name: Install NPM dependencies | |
run: npm install | |
- name: Minify CSS and JS files | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_FRONT_AUTH_TOKEN }} | |
run: npm run production | |
- name: Remove node_modules folder | |
run: rm -R node_modules | |
# !!! need mysql | |
# - name: Execute tests (Unit and Feature tests) via PHPUnit | |
# env: | |
# DB_CONNECTION: sqlite | |
# DB_DATABASE: database/database.sqlite | |
# run: | | |
# mkdir -p database | |
# touch database/database.sqlite | |
# php artisan migrate --force | |
# php artisan job:dispatch SxGeoUpdateJob | |
# php artisan test | |
- name: Deploy | |
env: | |
DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }} | |
DEPLOY_USER: ${{ secrets.DEPLOY_USER }} | |
DEPLOY_PORT: ${{ secrets.DEPLOY_PORT }} | |
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }} | |
run: | | |
mkdir -p ~/.ssh | |
touch ~/.ssh/deploy | |
(echo ${{ secrets.DEPLOY_SSH_KEY }} | base64 --decode -i > ~/.ssh/deploy) | |
chmod 700 ~/.ssh/deploy | |
php ./vendor/bin/dep deploy ${{ inputs.deploy_params }} | |
- name: Create Sentry release | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: production | |
- name: Send success status | |
uses: appleboy/telegram-action@master | |
with: | |
to: ${{ secrets.TELEGRAM_TO }} | |
token: ${{ secrets.TELEGRAM_TOKEN }} | |
format: html | |
disable_web_page_preview: true | |
message: | | |
<b>Success deploying ✅</b> | |
<blockquote expandable>${{ github.event.commits[0].message }}</blockquote> | |
################################## | |
### Run when a schedule failed ### | |
################################## | |
# restart_when_failed: | |
# name: Restarts workflow if failed | |
# runs-on: ubuntu-latest | |
# if: failure() && github.event.client_payload.attempt < 5 | |
# needs: laravel-tests-and-deploy | |
# steps: | |
# - name: Sleep for 1m 36s | |
# uses: jakejarvis/wait-action@master | |
# with: | |
# time: '96s' | |
# - name: set attempt | |
# run: | | |
# ATTEMPT=${{ github.event.client_payload.attempt }} | |
# ATTEMPT=$([ -n "$ATTEMPT" ] && echo $((++ATTEMPT)) || echo 1) | |
# echo "attempt=$ATTEMPT" >> $GITHUB_ENV | |
# - name: Send retry status | |
# uses: appleboy/telegram-action@master | |
# with: | |
# to: ${{ secrets.TELEGRAM_TO }} | |
# token: ${{ secrets.TELEGRAM_TOKEN }} | |
# message: Failure deploy (${{ env.attempt }}) ❌ Rerun 🔄 | |
# - name: Retry the workflow | |
# uses: peter-evans/repository-dispatch@v1 | |
# with: | |
# token: ${{ secrets.API_WORKFLOW_KEY }} | |
# event-type: retry-${{ env.attempt }} | |
# client-payload: '{"ref": "${{ github.ref }}", "attempt": "${{ env.attempt }}"}' |