diff --git a/.gitea/workflows/main.yaml b/.gitea/workflows/main.yaml new file mode 100644 index 0000000..8816277 --- /dev/null +++ b/.gitea/workflows/main.yaml @@ -0,0 +1,65 @@ +name: CI Workflow + +on: + push: + branches: + - '*' + +jobs: + test: + name: Testing the Block + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Set Up Python Environment + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + # - name: Install Python Dependencies + # run: | + # python -m pip install --upgrade pip + # pip install -r requirements.txt + + # - name: Execute Unit Tests + # run: python -m unittest discover -s . -p 'test_*.py' + + build_and_push: + name: Containerize the Block + runs-on: ubuntu-latest + needs: test + steps: + - name: Extract Repository Name + id: extract_repo + run: echo "repo_name=${GITHUB_REPOSITORY##*/}" >> $GITHUB_OUTPUT + + - name: Checkout Codebase + uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - name: Configure Docker Buildx + uses: docker/setup-buildx-action@v3 + with: + config-inline: | + [registry."centurion-version-control.default.svc.cluster.local:3000"] + http = true + insecure = true + + - name: Log In to Container Registry + uses: docker/login-action@v2 + with: + registry: centurion-version-control.default.svc.cluster.local:3000 + username: ${{ secrets.CI_USER }} + password: ${{ secrets.CI_USER_TOKEN }} + + - name: Build and Push Docker Image to Registry + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: | + centurion-version-control.default.svc.cluster.local:3000/centurion/${{ steps.extract_repo.outputs.repo_name }}/${{ github.ref_name }}:${{ github.sha }} + centurion-version-control.default.svc.cluster.local:3000/centurion/${{ steps.extract_repo.outputs.repo_name }}/${{ github.ref_name }}:latest \ No newline at end of file