Completed prod deploy also
This commit is contained in:
parent
f0c6f42bbf
commit
34b21fa7ae
|
@ -8,8 +8,6 @@ jobs:
|
||||||
Build-and-deploy-Production:
|
Build-and-deploy-Production:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event."
|
|
||||||
- run: echo " The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- run: echo " The ${{ gitea.repository }} repository has been cloned to the runner."
|
- run: echo " The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||||
|
@ -21,27 +19,31 @@ jobs:
|
||||||
- run: |
|
- run: |
|
||||||
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 install
|
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 install
|
||||||
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 run build
|
npm --prefix ${{ gitea.workspace }}/typescript/frontend-marios2 run build
|
||||||
- name: Configure SSH
|
- name: Copy Backend
|
||||||
run: |
|
uses: appleboy/scp-action@v0.1.4
|
||||||
mkdir -p ~/.ssh/
|
with:
|
||||||
echo "$SSH_KEY" > ~/.ssh/production.key
|
host: 194.182.190.208
|
||||||
chmod 600 ~/.ssh/production.key
|
username: ubuntu
|
||||||
cat >>~/.ssh/config <<END
|
key: ${{ secrets.PRODUCTION_SSH_KEY }}
|
||||||
Host production
|
source: "${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/"
|
||||||
HostName $SSH_HOST
|
target: "~/backend"
|
||||||
User $SSH_USER
|
|
||||||
IdentityFile ~/.ssh/production.key
|
- name: Copy Frontend
|
||||||
StrictHostKeyChecking no
|
uses: appleboy/scp-action@v0.1.4
|
||||||
END
|
with:
|
||||||
env:
|
host: 194.182.190.208
|
||||||
SSH_USER: ubuntu
|
username: ubuntu
|
||||||
SSH_KEY: ${{ secrets.PRODUCTION_SSH_KEY }}
|
key: ${{ secrets.PRODUCTION_SSH_KEY }}
|
||||||
SSH_HOST: ${{ secrets.PRODUCTION_SSH_HOST }}
|
source: "${{ gitea.workspace }}/typescript/frontend-marios2/"
|
||||||
- run: |
|
target: "~/frontend"
|
||||||
cd ${{ gitea.workspace }}
|
|
||||||
scp -r ./csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/ production:~/backend
|
- name: restart services
|
||||||
scp -r ./typescript/frontend-marios2/* production:~/frontend/
|
uses: appleboy/ssh-action@v0.1.4
|
||||||
ssh production 'sudo systemctl restart backend'
|
with:
|
||||||
ssh production 'sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/'
|
host: 194.182.190.208
|
||||||
ssh production 'sudo npm install -g serve'
|
username: ubuntu
|
||||||
- run: echo " This job's status is ${{ job.status }}."
|
password: ${{ secrets.PRODUCTION_SSH_PASSPHRASE }}
|
||||||
|
script: |
|
||||||
|
sudo systemctl restart backend
|
||||||
|
sudo cp -rf~/frontend/build/* /var/www/html/monitor.innov.energy/html/
|
||||||
|
sudo npm install -g serve
|
|
@ -8,8 +8,6 @@ jobs:
|
||||||
Build-and-deploy-Stage:
|
Build-and-deploy-Stage:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- run: echo " The job was automatically triggered by a ${{ gitea.event_name }} event."
|
|
||||||
- run: echo " The name of your branch is ${{ gitea.ref }} and your repository is ${{ gitea.repository }}."
|
|
||||||
- name: Check out repository code
|
- name: Check out repository code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
- run: echo " The ${{ gitea.repository }} repository has been cloned to the runner."
|
- run: echo " The ${{ gitea.repository }} repository has been cloned to the runner."
|
||||||
|
@ -47,34 +45,5 @@ jobs:
|
||||||
password: ${{ secrets.STAGE_SSH_PASSPHRASE }}
|
password: ${{ secrets.STAGE_SSH_PASSPHRASE }}
|
||||||
script: |
|
script: |
|
||||||
sudo systemctl restart backend
|
sudo systemctl restart backend
|
||||||
sudo cp -rf ~/frontend/build/*
|
sudo cp -rf~/frontend/build/* /var/www/html/monitor.innov.energy/html/
|
||||||
sudo npm install -g serve/var/www/html/monitor.innov.energy/html/
|
sudo npm install -g serve
|
||||||
|
|
||||||
- run: echo " This job's status is ${{ job.status }}."
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# - name: Configure SSH
|
|
||||||
# run: |
|
|
||||||
# mkdir -p /root/.ssh/
|
|
||||||
# touch /root/.ssh/config
|
|
||||||
# echo '$SSH_KEY' > /root/.ssh/id_rsa
|
|
||||||
# chmod 700 /root/.ssh/id_rsa
|
|
||||||
#
|
|
||||||
# cat >> /root/.ssh/config <<END
|
|
||||||
# Host staging
|
|
||||||
# HostName $SSH_HOST
|
|
||||||
# User $SSH_USER
|
|
||||||
# IdentityFile /root/.ssh/id_rsa
|
|
||||||
# StrictHostKeyChecking no
|
|
||||||
# END
|
|
||||||
# env:
|
|
||||||
# SSH_USER: ubuntu
|
|
||||||
# SSH_HOST: 91.92.154.141
|
|
||||||
# SSS_KEY: ${{ secrets.STAGING_SSH_KEY }}
|
|
||||||
# - run: scp -vo StrictHostKeyChecking=no -r ${{ gitea.workspace }}/csharp/App/Backend/bin/Release/net6.0/linux-x64/publish/ staging:~/backend
|
|
||||||
# - run: scp -vo StrictHostKeyChecking=no -r ${{ gitea.workspace }}/typescript/frontend-marios2/* staging:~/frontend/
|
|
||||||
# - run: ssh -vo StrictHostKeyChecking=no staging 'sudo systemctl restart backend'
|
|
||||||
# - run: ssh -vo StrictHostKeyChecking=no staging 'sudo cp -rf ~/frontend/build/* /var/www/html/monitor.innov.energy/html/'
|
|
||||||
# - run: ssh -vo StrictHostKeyChecking=no staging 'sudo npm install -g serve'
|
|
||||||
# - run: echo " This job's status is ${{ job.status }}."
|
|
Loading…
Reference in New Issue