Skip to content

Commit e1c9a52

Browse files
autodeploy
1 parent aa26aa5 commit e1c9a52

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: GitHub Actions Main
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
Explore-GitHub-Actions:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Stats
11+
run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
12+
- run: echo "🐧 This job is now running on a ${{ runner.os }} server hosted by GitHub!"
13+
- run: echo "🔎 The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
14+
- name: Install SSH Key
15+
uses: shimataro/ssh-key-action@v2
16+
with:
17+
key: ${{ secrets.PRIVATE_KEY }}
18+
known_hosts: 'just-a-placeholder-so-we-dont-get-errors'
19+
- name: Adding Known Hosts
20+
run: ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
21+
- uses: actions/checkout@v2
22+
- run: git checkout main
23+
- run: sudo apt-get update && sudo apt-get install -y openssh-client
24+
- run: chmod +x ./deploy.sh
25+
- name: Deploy on test environment
26+
run: cat ./deploy.sh | ssh [email protected]
27+
- run: echo "Deploying to test environment"

deploy.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
set -eu
2+
set -o pipefail
3+
echo "Deploy script started"
4+
cd /usr/share/nginx/html/soft_ui_dashboard_laravel_free/ # go to project repository on the server
5+
git fetch --all
6+
php8.0 artisan down
7+
git reset --hard origin/main
8+
php8.0 /usr/local/bin/composer install --no-interaction #install php part
9+
php8.0 artisan migrate:fresh --seed
10+
php8.0 artisan optimize:clear
11+
php8.0 artisan view:clear
12+
php8.0 artisan route:clear
13+
php8.0 artisan config:clear
14+
php8.0 artisan view:cache
15+
php8.0 artisan route:cache
16+
php8.0 artisan storage:link
17+
chown -R www-data:www-data /usr/share/nginx/html/soft_ui_dashboard_laravel_free/ #change here too project repository
18+
php8.0 artisan up
19+
source ~/.nvm/nvm.sh
20+
npm install
21+
npm run prod
22+
echo "Deploy script finished execution"

0 commit comments

Comments
 (0)