Adjusting pipelines #54
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: CD-Sonar Metrics Collector | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Deploy-ssh | |
runs-on: ubuntu-latest | |
steps: | |
- name: Executing remote ssh commands | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
port: ${{ secrets.SSH_PORT }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
script: | | |
cd db1-projects/sonar-metrics-collector/; | |
docker container stop sonar-metrics-collector; | |
docker rm sonar-metrics-collector; | |
git pull origin main; | |
rm -rf .env | |
touch .env | |
echo SONAR_USER_TOKEN=${{ secrets.SONAR_USER_TOKEN }} >> .env | |
echo PORT=5100 >> .env | |
docker rmi sonar-metrics-collector; | |
docker build -t sonar-metrics-collector .; | |
docker run -d -t -i -p 5100:5100 --net metrics-collector --name sonar-metrics-collector sonar-metrics-collector:latest npm run start:prod |