diff --git a/.gitea/workflows/ci-cd.yml b/.gitea/workflows/ci-cd.yml new file mode 100644 index 0000000..7322a2e --- /dev/null +++ b/.gitea/workflows/ci-cd.yml @@ -0,0 +1,48 @@ +name: CI/CD - Vijaya Core +on: + pull_request: + branches: + - production + types: + - closed +jobs: + build-and-deploy: + name: Build & Deploy + runs-on: linux + if: github.event.pull_request.merged == true + steps: + - name: Checkout code + run: | + git clone \ + --depth 1 \ + --branch production \ + https://oauth2:${{ secrets.VIJAYA }}@gitea.hexdive.com/Vijaya_Gym/Core_Be.git \ + . + - name: Restore + run: dotnet restore Fitness-core-BE.sln + - name: Publish + run: | + rm -rf /tmp/vijayacore-deploy + mkdir -p /tmp/vijayacore-deploy + dotnet publish Fitness_core_BE.csproj \ + -c Release \ + -r linux-x64 \ + --self-contained true \ + -o /tmp/vijayacore-deploy + - name: Stop service + run: systemctl stop vijayacore.service + - name: Copy to deploy folder + run: | + rm -rf /home/vijayasport/core/publish/* + cp -r /tmp/vijayacore-deploy/* /home/vijayasport/core/publish/ + - name: Fix ownership and permissions + run: | + chown -R vijayasportuser:vijayasportuser /home/vijayasport/core/publish + find /home/vijayasport/core/publish -type d -exec chmod 755 {} + + find /home/vijayasport/core/publish -type f -exec chmod 644 {} + + chmod +x /home/vijayasport/core/publish/Fitness_core_BE + - name: Restart service + run: systemctl restart vijayacore.service + - name: Verify + run: | + systemctl is-active vijayacore.service && echo "✅ Service running" || echo "❌ Service failed" diff --git a/appsettings.json b/appsettings.json index d3cd013..8b09d11 100644 --- a/appsettings.json +++ b/appsettings.json @@ -12,7 +12,7 @@ "Kestrel": { "Endpoints": { "Http": { - "Url": "http://0.0.0.0:5601" + "Url": "http://0.0.0.0:5632" } },