name: deploy-socialize on: push: branches: - main jobs: test: runs-on: dotnet steps: - uses: actions/checkout@v4 - run: dotnet test backend/Socialize.slnx image: needs: test runs-on: docker steps: - uses: actions/checkout@v4 - name: Login to Gitea container registry run: docker login git.mapachotes.com -u "$REGISTRY_USER" -p "$REGISTRY_PASSWORD" - name: Build images run: | docker build \ -t git.mapachotes.com/jbourdon/socialize-api:${{ gitea.sha }} \ -t git.mapachotes.com/jbourdon/socialize-api:latest \ -f backend/src/Socialize.Api/Dockerfile . docker build \ --build-arg VITE_API_URL=/api \ -t git.mapachotes.com/jbourdon/socialize-web:${{ gitea.sha }} \ -t git.mapachotes.com/jbourdon/socialize-web:latest \ -f frontend/Dockerfile . - name: Push images run: | docker push git.mapachotes.com/jbourdon/socialize-api:${{ gitea.sha }} docker push git.mapachotes.com/jbourdon/socialize-api:latest docker push git.mapachotes.com/jbourdon/socialize-web:${{ gitea.sha }} docker push git.mapachotes.com/jbourdon/socialize-web:latest deploy: needs: image runs-on: bookworm steps: - name: Install SSH client run: apt-get update && apt-get install -y openssh-client - name: Deploy on sobina run: | mkdir -p ~/.ssh printf '%s\n' "$DEPLOY_SSH_PRIVATE_KEY" > ~/.ssh/deploy_key chmod 600 ~/.ssh/deploy_key ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=accept-new "$DEPLOY_USER@$DEPLOY_HOST" \ 'cd /srv/prod/socialize && ./deploy.sh'