From 8f99ee617a9d8a600dc92f112435b58c8386d415 Mon Sep 17 00:00:00 2001 From: Zura Sekhniashvili Date: Sun, 17 Dec 2023 19:49:11 +0400 Subject: [PATCH 1/5] Testing github actions --- .github/.workflows/deploy.yml | 60 +++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 .github/.workflows/deploy.yml diff --git a/.github/.workflows/deploy.yml b/.github/.workflows/deploy.yml new file mode 100644 index 0000000..8d8001e --- /dev/null +++ b/.github/.workflows/deploy.yml @@ -0,0 +1,60 @@ +name: Deploy + +on: + push: + branches: [main] +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: mirromutth/mysql-action@v1.1 + with: + mysql database: laravel-test-db + mysql user: laravel_test_user + mysql password: example + - name: Copy .env + run: cp .env.example .env + - name: Install composer Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + - name: Install node dependencies + run: npm ci + - name: Setup Project + run: | + php artisan config:clear + php artisan cache:clear + php artisan key:generate + npm run build + - name: Directory Permissions + run: chmod 755 -R storage bootstrap/cache + - name: Run Unit tests + env: + APP_ENV: testing + DB_CONNECTION: mysql + DB_USERNAME: laravel_test_user + DB_PASSWORD: super_secret + DB_DATABASE: laravel_test_db + run: php artisan test + - name: Deploy to Server + if: ${{ success() }} + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SSH_HOST }} + port: ${{ secrets.SSH_PORT }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_KEY }} + script_stop: true + script: | + cd apps + cd laravel-example + git pull + npm ci + npm run prod + composer i + php artisan migrate --force From 581bab988cbe45e8538c8e35ebf04f78916a427f Mon Sep 17 00:00:00 2001 From: Zura Sekhniashvili Date: Sun, 17 Dec 2023 19:53:11 +0400 Subject: [PATCH 2/5] Rename .workflows directory into workflows --- .github/{.workflows => workflows}/deploy.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/{.workflows => workflows}/deploy.yml (100%) diff --git a/.github/.workflows/deploy.yml b/.github/workflows/deploy.yml similarity index 100% rename from .github/.workflows/deploy.yml rename to .github/workflows/deploy.yml From df2e68660b19265ea4bfafa4f288b029e6c72535 Mon Sep 17 00:00:00 2001 From: Zura Sekhniashvili Date: Sun, 17 Dec 2023 19:55:37 +0400 Subject: [PATCH 3/5] Remove unit tests section from workflows --- .github/workflows/deploy.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 8d8001e..985656c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -33,14 +33,14 @@ jobs: npm run build - name: Directory Permissions run: chmod 755 -R storage bootstrap/cache - - name: Run Unit tests - env: - APP_ENV: testing - DB_CONNECTION: mysql - DB_USERNAME: laravel_test_user - DB_PASSWORD: super_secret - DB_DATABASE: laravel_test_db - run: php artisan test +# - name: Run Unit tests +# env: +# APP_ENV: testing +# DB_CONNECTION: mysql +# DB_USERNAME: laravel_test_user +# DB_PASSWORD: super_secret +# DB_DATABASE: laravel_test_db +# run: php artisan test - name: Deploy to Server if: ${{ success() }} uses: appleboy/ssh-action@master From 4ae01a024acd7a902b0d9e7aba149d07260c57f0 Mon Sep 17 00:00:00 2001 From: Zura Sekhniashvili Date: Sun, 17 Dec 2023 20:08:41 +0400 Subject: [PATCH 4/5] Rename deploy.yml into deploy-main.yml --- .github/workflows/deploy-main.yml | 58 +++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/deploy-main.yml diff --git a/.github/workflows/deploy-main.yml b/.github/workflows/deploy-main.yml new file mode 100644 index 0000000..4c796f4 --- /dev/null +++ b/.github/workflows/deploy-main.yml @@ -0,0 +1,58 @@ +name: Deploy + +on: + push: + branches: [main] +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: shivammathur/setup-php@v2 + with: + php-version: '8.1' + - uses: actions/checkout@v2 + - uses: actions/setup-node@v3 + with: + node-version: 16 + - uses: mirromutth/mysql-action@v1.1 + with: + mysql database: laravel-test-db + mysql user: laravel_test_user + mysql password: example + - name: Copy .env + run: cp .env.example .env + - name: Install composer Dependencies + run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist + - name: Install node dependencies + run: npm ci + - name: Setup Project + run: | + php artisan config:clear + php artisan cache:clear + php artisan key:generate + npm run build + - name: Directory Permissions + run: chmod 755 -R storage bootstrap/cache +# - name: Run Unit tests +# env: +# APP_ENV: testing +# DB_CONNECTION: mysql +# DB_USERNAME: laravel_test_user +# DB_PASSWORD: super_secret +# DB_DATABASE: laravel_test_db +# run: php artisan test + - name: Deploy to Server + if: ${{ success() }} + uses: appleboy/ssh-action@master + with: + host: ${{ secrets.SSH_HOST }} + port: ${{ secrets.SSH_PORT }} + username: ${{ secrets.SSH_USERNAME }} + key: ${{ secrets.SSH_KEY }} + script_stop: true + script: | + cd domains + cd lcommerce.net + git pull + composer install + php artisan migrate --force From 15d3cc6dc112a789a0c4d3c2ada15e5da7dc0296 Mon Sep 17 00:00:00 2001 From: Zura Sekhniashvili Date: Sun, 17 Dec 2023 20:08:57 +0400 Subject: [PATCH 5/5] Add deploy-demo.yml in .github/workflows --- .github/workflows/{deploy.yml => deploy-demo.yml} | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) rename .github/workflows/{deploy.yml => deploy-demo.yml} (92%) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy-demo.yml similarity index 92% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-demo.yml index 985656c..83b5279 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-demo.yml @@ -2,7 +2,7 @@ name: Deploy on: push: - branches: [main] + branches: [demo] jobs: deploy: runs-on: ubuntu-latest @@ -51,10 +51,8 @@ jobs: key: ${{ secrets.SSH_KEY }} script_stop: true script: | - cd apps - cd laravel-example + cd domains + cd lcommerce.net git pull - npm ci - npm run prod - composer i + composer install php artisan migrate --force