[main] trest ci cd #58
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 and Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18.17.1" | |
architecture: "x64" | |
- name: Install npm | |
run: | | |
npm install -g npm@9.6.7 | |
- name: Install dependencies | |
run: | | |
cd app | |
npm install | |
- name: Set CI to false | |
run: echo "CI=false" >> $GITHUB_ENV | |
- name: Build | |
run: | | |
cd app | |
echo "Current directory: $(pwd)" | |
ls -la | |
npm -v | |
node -v | |
npm run build --loglevel verbose | |
echo "Build complete" | |
- name: Deploying | |
uses: appleboy/ssh-action@master # An action made to control Linux servers | |
with: # We set all our secrets here for the action, these won't be shown in the action logs | |
host: ${{ secrets.SERVER_HOST }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
password: ${{ secrets.SERVER_PASSWORD }} | |
#port: ${{ secrets.PORT }} | |
script: | | |
cd Bigbee-front | |
ls | |
git pull | |
cd app | |
npm run build | |
cd build | |
cp /build/* /var/www/bigbee.mnogosushi.kg/* | |
ls | |
sudo systemctl restart nginx | |