add: Great Readme.md #40
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: Ricash CI - Build & Push Docker Image | |
| on: | |
| pull_request: | |
| branches: [ develop ] | |
| push: | |
| branches: [ develop, main ] | |
| permissions: | |
| contents: read | |
| packages: write | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ricash-org/notification-service | |
| jobs: | |
| build: | |
| 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 GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # ---------- PR BUILD (NO PUSH) ---------- | |
| - name: Build Docker image (PR) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| docker build -t $REGISTRY/$IMAGE_NAME:pr-${{ github.event.pull_request.number }} . | |
| # ---------- DEVELOP ---------- | |
| - name: Build & Push (develop) | |
| if: github.ref == 'refs/heads/develop' | |
| run: | | |
| docker build -t $REGISTRY/$IMAGE_NAME:dev . | |
| docker push $REGISTRY/$IMAGE_NAME:dev | |
| # ---------- MAIN / PROD ---------- | |
| - name: Build & Push (prod) | |
| if: github.ref == 'refs/heads/main' | |
| run: | | |
| docker build -t $REGISTRY/$IMAGE_NAME:prod . | |
| docker push $REGISTRY/$IMAGE_NAME:prod |