[CI] - Status Badge #2
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: Build NextApp Preview and Deploy | |
on: | |
push: | |
branches-ignore: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.19.0] | |
# node-version: [20.x, 21.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: connecting to Server | |
uses: appleboy/ssh-action@master | |
env: | |
FOO: 'BAR' | |
BAR: 'FOO' | |
SHA: ${{ github.sha }} | |
with: | |
host: ${{ secrets.DOGDB_HOST}} | |
username: ${{ secrets.DOGDB_USERNAME }} | |
port: ${{ secrets.DOGDB_PORT }} | |
key: ${{ secrets.DOGDB_PRIVATE_SSHKEY }} | |
source: '.' | |
# source: '.,!node_modules' | |
target: '~/var/www/' | |
- name: Executing remote command | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.DOGDB_HOST}} | |
username: ${{ secrets.DOGDB_USERNAME }} | |
port: ${{ secrets.DOGDB_PORT }} | |
key: ${{ secrets.DOGDB_PRIVATE_SSHKEY }} | |
script: | | |
cd ~ && cd /var/www/ | |
if [ ! -d "${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}" -a ! -d "${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}-${{ github.ref_name }}" ]; then | |
mkdir ${{ secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME }} && cd ${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}} && git clone -b ${{ github.ref_name }} https://github.com/dogdb-org/dogdb-frontend.git ${{ secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME }}-${{ github.ref_name }} && ${{ secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME }}-${{ github.ref_name }} && npm install && npm test && npm run build | |
elif [ -d "${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}" -a ! -d "${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}/${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}-${{ github.ref_name }}" ]; then | |
cd ${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}} && git clone -b ${{ github.ref_name }} https://github.com/dogdb-org/dogdb-frontend.git ${{ secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME }}-${{ github.ref_name }} && cd ${{ secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME }}-${{ github.ref_name }} && npm install && npm test && npm run build | |
elif [ -d "${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}" -a -d "${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}/${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}-${{ github.ref_name }}" ]; then | |
cd ${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}/${{secrets.DOGDB_PREVIEW_FRONTEND_FOLDER_NAME}}-${{ github.ref_name }} && git pull && npm install && npm test && npm run build | |
fi |