name: Deploy Nyla Frontend to Integration on: push: branches: - int workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true env: SERVER_HOST: porta-int.poweron.swiss SERVER_USER: ubuntu APP_DIR: /srv/nyla/current jobs: deploy: runs-on: ubuntu-latest steps: - name: Setup SSH run: | mkdir -p ~/.ssh printf '%s\n' "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key chmod 600 ~/.ssh/deploy_key echo "StrictHostKeyChecking=no" >> ~/.ssh/config echo "UserKnownHostsFile=/dev/null" >> ~/.ssh/config - name: Deploy run: | ssh -i ~/.ssh/deploy_key ${{ env.SERVER_USER }}@${{ env.SERVER_HOST }} " set -e cd ${{ env.APP_DIR }} git remote set-url origin ssh://git@git.poweron.swiss:2222/PowerOn/ui-nyla.git git fetch origin int git reset --hard origin/int cp config/env-int.env .env rm -f config/env-*.env npm ci npm run build:int " - name: Health Check run: | HTTP_STATUS=$(curl -sk -o /dev/null -w "%{http_code}" \ https://${{ env.SERVER_HOST }}/ || echo "000") if [ "$HTTP_STATUS" = "200" ]; then echo "Health check passed! (HTTP $HTTP_STATUS)" else echo "Health check returned HTTP $HTTP_STATUS" fi