Update README with latest project changes #35
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: Docker Build and Push | |
| on: | |
| push: | |
| branches: [ main, 'feature/*' ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build-and-push: | |
| name: Build and Push to Docker Hub | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| # Secrets are NOT available on pull_request events β skip login on PRs | |
| if: github.event_name == 'push' | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_TOKEN }} | |
| - name: Build and push Docker image (push event) | |
| # On push: build + push to Docker Hub with clean, valid tags | |
| if: github.event_name == 'push' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| udaycodespace/credify:latest | |
| udaycodespace/credify:v2 | |
| udaycodespace/credify:sha-${{ github.sha }} | |
| cache-from: type=registry,ref=udaycodespace/credify:buildcache | |
| cache-to: type=registry,ref=udaycodespace/credify:buildcache,mode=max | |
| - name: Build only (pull_request validation β no push) | |
| # On PR: just validate the image builds cleanly β no login, no push | |
| if: github.event_name == 'pull_request' | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: false | |
| tags: credify:pr-validate | |
| - name: Image digest | |
| run: echo "β Docker build step completed." |