diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..e33aa84 --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -0,0 +1,52 @@ +name: Gitea CI-CD Pipeline + +on: + push: + branches: [main, develop] + pull_request: + branches: [main] + +jobs: + # --- STAGE 1: TEST --- + test: + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install Dependencies + run: npm ci + + - name: Run Linter + run: npm run lint + + - name: Run Tests + run: npm test + + # --- STAGE 2: BUILD & PUBLISH (Only on Main) --- + build-and-deploy: + needs: test + if: github.ref == 'refs/heads/main' && github.event_name == 'push' + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + # Example: Building a Docker Image and pushing to Gitea's internal registry + - name: Login to Gitea Registry + uses: docker/login-action@v3 + with: + registry: gitea.starfour.de + username: ${{ gitea.actor }} + password: ${{ secrets.GITEA_TOKEN }} + + - name: Build and Push + uses: docker/build-push-action@v5 + with: + push: true + tags: gitea.starfour.de/${{ github.repository }}:latest \ No newline at end of file