Skip to content

Commit

Permalink
Merge pull request #81 from chorkleines/feature/deploy-ci
Browse files Browse the repository at this point in the history
Deploy Application
  • Loading branch information
nozomu-y authored Aug 11, 2023
2 parents 3586fc3 + 79606c3 commit feab64d
Showing 1 changed file with 87 additions and 0 deletions.
87 changes: 87 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Deploy Application

on:
workflow_dispatch:

jobs:
prepare:
name: Prepare
runs-on: ubuntu-latest

steps:
- name: Delete Old Application
uses: appleboy/ssh-action@v1.0.0
env:
APPLICATION_PATH: ${{ secrets.APPLICATION_PATH }}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
envs: APPLICATION_PATH
script: |
cd $APPLICATION_PATH
# check if $APPLICATION_PATH is under kleines-mypage directory
if [[ "$(pwd)" == *"kleines-mypage/"* ]]; then
rm -rf $(ls)
fi
client:
name: Deploy Client Application
needs: prepare
runs-on: ubuntu-latest

steps:
- uses: actions/setup-node@v3
with:
node-version: 16.x
- uses: actions/checkout@v3
- name: Install Dependencies
run: npm install
working-directory: ./client
- name: Build Client Application
run: npm run generate
working-directory: ./client
- name: Deploy Client Application
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
source: client/.output/public/*
target: ${{ secrets.APPLICATION_PATH }}
strip_components: 3

api:
name: Deploy API Application
needs: prepare
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Deploy API Application
uses: appleboy/scp-action@v0.1.4
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
source: api
target: ${{ secrets.APPLICATION_PATH }}
- name: Migrate Server
uses: appleboy/ssh-action@v1.0.0
env:
APPLICATION_PATH: ${{ secrets.APPLICATION_PATH }}
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
envs: APPLICATION_PATH
script: |
cd $APPLICATION_PATH
cp .env api/
cd api
~/local/composer/composer.phar install
php artisan migrate

0 comments on commit feab64d

Please sign in to comment.