# CI/CD pipeline for Novelly. Read by both Gitea Actions and GitHub Actions (both look # under .github/workflows/). Every non-checkout step just invokes a bash script under # scripts/ci/, so the entire pipeline is reproducible by running the same scripts # locally — no marketplace build/test/push actions. # # Gitea (origin) is the only remote that runs this on push — gated by the # `github.server_url` check below (identical on both engines: https://github.com on # GitHub, the Gitea instance URL on Gitea). GitHub pushes intentionally do nothing for # now; GitHub will get its own release-triggered workflow later. name: CI on: push: paths-ignore: [badges/**] jobs: build-and-push: if: github.server_url != 'https://github.com' runs-on: ubuntu-latest permissions: contents: write env: REGISTRY: ${{ secrets.REGISTRY }} REGISTRY_OWNER: ${{ secrets.REGISTRY_OWNER }} REGISTRY_USER: ${{ secrets.REGISTRY_USER }} REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} steps: - uses: actions/checkout@v4 - name: Build run: ./scripts/ci/build.sh - name: Test run: ./scripts/ci/test.sh - name: Coverage report run: ./scripts/ci/coverage.sh - name: Publish coverage badge env: GITHUB_TOKEN: ${{ github.token }} run: ./scripts/ci/publish-coverage-badge.sh - name: Build Docker images if: github.ref_name == 'main' run: ./scripts/ci/docker-build.sh - name: Push Docker images if: github.ref_name == 'main' run: ./scripts/ci/docker-push.sh deploy: needs: build-and-push if: success() && github.ref_name == 'main' runs-on: [self-hosted, qa] env: REGISTRY: ${{ secrets.REGISTRY }} REGISTRY_OWNER: ${{ secrets.REGISTRY_OWNER }} REGISTRY_USER: ${{ secrets.REGISTRY_USER }} REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} WEB_PORT: ${{ vars.WEB_PORT }} steps: # actions/checkout@v4 is a Node-based action; this runner has no node in PATH, so # checkout plain git instead of via marketplace action. - name: Checkout run: | git init -q . git remote add origin "${{ github.server_url }}/${{ github.repository }}.git" git -c http.extraheader="AUTHORIZATION: bearer ${{ github.token }}" fetch --depth=1 origin "${{ github.sha }}" git checkout -q FETCH_HEAD - name: Deploy run: ./scripts/ci/deploy.sh