name: CI/CD Pipeline on: push: branches: [main] jobs: docker: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - name: Setup Docker Buildx uses: docker/setup-buildx-action@v3 - name: Setup variables run: | DOCKER_REGISTRY=$(echo "${{ gitea.server_url }}" | sed 's|https://||') echo "DOCKER_REGISTRY=$DOCKER_REGISTRY" >> $GITHUB_ENV REGISTRY_IMAGE="$DOCKER_REGISTRY/$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')" echo "REGISTRY_IMAGE=$REGISTRY_IMAGE" >> $GITHUB_ENV - name: Login to Container Registry uses: docker/login-action@v3 with: registry: ${{ env.DOCKER_REGISTRY }} username: ${{ secrets.CR_USER }} password: ${{ secrets.CR_TOKEN }} - name: Extract metadata id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY_IMAGE }} tags: | type=ref,event=branch type=sha,prefix= type=raw,value=latest,enable={{is_default_branch}} - name: Build and push uses: docker/build-push-action@v5 with: context: . file: ./Dockerfile platforms: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha cache-to: type=gha,mode=max