name: Build and Publish Docker Image on: push: branches: - main # Trigger on pushes to the 'main' branch workflow_dispatch: # Allow manual triggering of the workflow jobs: build-and-publish: runs-on: ubuntu-latest steps: # Checkout the code - name: Checkout code uses: actions/checkout@v3 # Log in to Docker Hub using GitHub credentials - name: Log in to Docker Hub uses: docker/login-action@v2 with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} # Build the Docker image - name: Build Docker Image run: | docker build -t ${{ secrets.DOCKER_USERNAME }}/hl-server:latest . # Push the Docker image to Docker Hub - name: Push Docker Image run: | docker push ${{ secrets.DOCKER_USERNAME }}/hl-server:latest