This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - "**" # Triggers on all branches | |
| tags: | |
| - "v*.*.*" # Triggers on tag push for versioned tags (e.g., v1.0.0) | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| - name: Log in to Quay.io | |
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login quay.io -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| - name: Get tag or commit SHA | |
| id: vars | |
| run: | | |
| if [ "${{ github.event_name }}" = "push" ] && [ -n "${{ github.ref_name }}" ]; then | |
| echo "image_tag=${{ github.ref_name }}" >> $GITHUB_ENV | |
| else | |
| echo "image_tag=${{ github.sha }}" >> $GITHUB_ENV | |
| fi | |
| - name: Build Docker Image | |
| run: make build | |
| - name: Tag Docker Image | |
| run: docker tag fleet-telemetry-consumer quay.io/rajsinghcpre/fleet-telemetry-consumer:${{ env.image_tag }} | |
| - name: Push Docker Image | |
| run: docker push quay.io/rajsinghcpre/fleet-telemetry-consumer:${{ env.image_tag }} |