Deploy Application #7
Workflow file for this run
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: Deploy Application | |
on: | |
workflow_dispatch: | |
pull_request: | |
branches: ["*"] | |
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 | |
rm -rf $(ls) | |
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 | |
php artisan migrate |