Skip to content

Commit a97e5e3

Browse files
committed
added github actions
1 parent d33cc1c commit a97e5e3

File tree

2 files changed

+78
-6
lines changed

2 files changed

+78
-6
lines changed

.github/workflows/build.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: laravel-build
2+
on:
3+
push:
4+
branches:
5+
- develop
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Checkout code
11+
uses: actions/checkout@v3
12+
13+
- name: Setup Node.js
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: '20'
17+
18+
- name: Setup PHP
19+
uses: shivammathur/setup-php@master
20+
with:
21+
php-version: 8.3
22+
extensions: mbstring, ctype, fileinfo, openssl, PDO, bcmath, json, tokenizer, xml
23+
24+
- name: Install Composer dependencies
25+
run: composer install --no-dev --no-interaction --prefer-dist
26+
27+
- name: Install npm dependencies
28+
run: npm install
29+
30+
- name: Build assets
31+
run: npm run build
32+
33+
- name: Clean up
34+
run: |
35+
rm -rf node_modules
36+
rm -rf storage/app/public/activities
37+
rm -rf storage/app/public/certifications
38+
rm -rf storage/app/public/logos
39+
mkdir -p storage/app/private/orders/
40+
- name: Archive application
41+
run: tar -czf app.tgz ./*
42+
43+
- name: SSH SCP and deployment
44+
uses: cross-the-world/ssh-scp-ssh-pipelines@latest
45+
env:
46+
WELCOME: "ssh scp ssh pipelines"
47+
LASTSSH: "Doing something after copying"
48+
with:
49+
host: ${{ secrets.SSH_HOST }}
50+
user: ${{ secrets.SSH_USER }}
51+
pass: ${{ secrets.SSH_PASSWORD }}
52+
port: ${{ secrets.SSH_PORT }}
53+
connect_timeout: 10s
54+
scp: |
55+
'./app.tgz' => ${{ secrets.SSH_DIR }}
56+
last_ssh: |
57+
cd ${{ secrets.SSH_DIR }}
58+
tar -xzf app.tgz
59+
composer install --optimize-autoloader --no-dev
60+
npm install --production
61+
cp env.example .env
62+
sed -i "s/DB_CONNECTION=.*/DB_CONNECTION=${{ secrets.DB_CONNECTION }}/" .env
63+
sed -i "s/DB_HOST=.*/DB_HOST=${{ secrets.DB_HOST }}/" .env
64+
sed -i "s/DB_PORT=.*/DB_PORT=${{ secrets.DB_PORT }}/" .env
65+
sed -i "s/DB_DATABASE=.*/DB_DATABASE=${{ secrets.DB_DATABASE }}/" .env
66+
sed -i "s/DB_USERNAME=.*/DB_USERNAME=${{ secrets.DB_USERNAME }}/" .env
67+
sed -i "s/DB_PASSWORD=.*/DB_PASSWORD=${{ secrets.DB_PASSWORD }}/" .env
68+
php artisan migrate --force
69+
php artisan storage:link
70+
mkdir -p storage/framework/views
71+
chown -R www-data:www-data storage
72+
chmod -R 775 storage

.env.example env.example

+6-6
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ LOG_STACK=single
2121
LOG_DEPRECATIONS_CHANNEL=null
2222
LOG_LEVEL=debug
2323

24-
DB_CONNECTION=sqlite
25-
# DB_HOST=127.0.0.1
26-
# DB_PORT=3306
27-
# DB_DATABASE=laravel
28-
# DB_USERNAME=root
29-
# DB_PASSWORD=
24+
DB_CONNECTION=
25+
DB_HOST=
26+
DB_PORT=
27+
DB_DATABASE=
28+
DB_USERNAME=
29+
DB_PASSWORD=
3030

3131
SESSION_DRIVER=database
3232
SESSION_LIFETIME=120

0 commit comments

Comments
 (0)