diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 6fc7011..fc22747 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -8,41 +8,40 @@ on: jobs: build: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - # list of Docker images to use as base name for tags - images: timofeytst/eat-place + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ secrets.DOCKERHUB_USERNAME }}/eat-place - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - # - name: Get branch name - # uses: nelonoel/branch-name@v1.0.1 - # - run: echo ${BRANCH_NAME} + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - - name: Build and push - uses: docker/build-push-action@v5 - with: - push: true - file: Dockerfile.prod - # tags: timofeytst/eat-place:${BRANCH_NAME} - tags: ${{ steps.meta.outputs.tags }} + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build and push + uses: docker/build-push-action@v5 + with: + push: true + file: | + if [ "$GITHUB_REF" == "refs/heads/prod" ]; then + echo "Dockerfile.prod" + else + echo "Dockerfile" + fi + tags: ${{ steps.meta.outputs.tags }} deploy: