name: CI/CD Pipeline on: push: branches: [master] jobs: build: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to Docker Hub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Build Docker images run: docker-compose build - name: Push Docker images run: docker-compose push test: runs-on: ubuntu-latest needs: build steps: - name: Checkout code uses: actions/checkout@v2 - name: Run test run: | docker-compose up -d app prometheus grafana docker-compose run --rm tests docker-compose down push: runs-on: ubuntu-latest needs: test steps: - name: Checkout code uses: actions/checkout@v2 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - name: Login to Docker Hub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Deploy services locally run: | docker-compose pull docker-compose up -d app prometheus grafana # docker-compose up -d deploy: runs-on: ubuntu-latest needs: push steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - name: Deploy to Hugging Face Spaces env: HF_TOKEN: ${{ secrets.HF_TOKEN }} run: git push --force https://macrdel:$HF_TOKEN@huggingface.co/spaces/macrdel/sentiment-summarize-youtube-comms master:main