diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index fb895c4..1c951ed 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -15,10 +15,10 @@ jobs: with: ref: CI-CD-pipline - - name: Switch to Backend Branch - run: | - git fetch origin - git checkout main-backend + # - name: Switch to Backend Branch + # run: | + # git fetch origin + # git checkout main-backend - name: Log in to Docker Hub uses: docker/login-action@v3 @@ -27,16 +27,19 @@ jobs: password: ${{ secrets.DOCKER_ACCESS_TOKEN}} - name: Extract the latest Git tag - run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV + run: | + echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV + echo $TAG - name: Build and Push Backend Image uses: docker/build-push-action@v6 with: push: true tags: noraali/backend:${{ env.TAG }} - context: . #./backend + context: . #./backend file: ./Dockerfile #./backend/Dockerfile + # build-frontend: # runs-on: ubuntu-latest @@ -49,7 +52,7 @@ jobs: # - name: Switch to frontend Branch # run: | # git fetch origin - # git checkout main-frontend + # git checkout main-frontend # - name: Log in to Docker Hub # uses: docker/login-action@v3 @@ -58,7 +61,7 @@ jobs: # password: ${{ secrets.DOCKER_ACCESS_TOKEN}} # - name: Extract the latest Git tag - # run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV + # run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV # - name: Build and Push frontend Image # uses: docker/build-push-action@v6 @@ -67,21 +70,11 @@ jobs: # tags: noraali/frontend:${{ env.TAG }} # context: . #./frontend # file: ./Dockerfile #./frontend/Dockerfile - - - - - - - # branches: - # - CI-CD-pipline - # - main-backend - # - main-frontend - - - - # if: github.ref == 'refs/heads/CI-CD-pipline' - # main-backend +# - CI-CD-pipline +# - main-backend +# - main-frontend +# if: github.ref == 'refs/heads/CI-CD-pipline' +# main-backend diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..44bacb9 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,36 @@ +name: CI/CD Pipeline + +on: + push: + # branches: + # - CI-CD-pipline + # - main-backend + # - main-frontend + tags: + - v* + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_ACCESS_TOKEN}} + + - name: Extract the latest Git tag + run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV + + - name: Build and Push Backend Image + # if: github.ref == 'refs/heads/CI-CD-pipline' main-backend + uses: docker/build-push-action@v6 + with: + push: true + tags: noraali/backend:${{ env.TAG }} + context: . + file: ./Dockerfile