refactor CI/CD #23
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 | |
on: | |
push: | |
branches: | |
- main # Deploy on push to the main branch | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: ikarus.arrow-silver.com | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v3 | |
- name: executing remote ssh commands | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.VPS_IP }} | |
username: ${{ secrets.DEPLOY_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
cd /root/projects/ikarus || exit | |
git checkout . | |
git checkout main | |
git pull origin main | |
sudo docker-compose down | |
sudo docker-compose build --no-cache | |
echo "ENVIRONMENT=release" > app.env | |
echo "DB_SOURCE=${{ secrets.DB_SOURCE }}" >> app.env | |
echo "HTTP_SERVER_ADDRESS=${{ secrets.HTTP_SERVER_ADDRESS }}" >> app.env | |
echo "TOKEN_SYMMETRIC_KEY=${{ secrets.TOKEN_SYMMETRIC_KEY }}" >> app.env | |
echo "DOMAIN_ADDRESS=${{ secrets.DOMAIN }}" >> app.env | |
echo "SESSION_NAME=${{ secrets.SESSION_NAME }}" >> app.env | |
sudo DOMAIN_ADDRESS=${{ secrets.DOMAIN }} docker-compose up -d | |
sudo docker system prune -f |