Skip to content

Commit

Permalink
Update ci-cd.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
furkmak authored Sep 23, 2024
1 parent 512b933 commit 6796421
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,21 @@ jobs:

steps:
- name: Check out the code
uses: actions/checkout@v3 # Updated to v3 for node16+ support
uses: actions/checkout@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2 # Updated to v2 for node16+ support
uses: docker/setup-buildx-action@v2

- name: Build Docker image
- name: Log in to Docker Hub (or another registry)
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

- name: Build and Push Docker image (latest)
run: |
docker build -t furkmak/legalapp:latest .
docker push furkmak/legalapp:latest
- name: Run FastAPI application and test Q&A
run: |
Expand All @@ -37,19 +44,20 @@ jobs:

steps:
- name: Check out the code
uses: actions/checkout@v3 # Updated to v3
uses: actions/checkout@v2

- name: Log in to Docker Hub (or another registry)
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
run: echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

- name: Push Docker image
- name: Pull Docker image (latest)
run: docker pull furkmak/legalapp:latest

- name: Tag and Push Docker image with version
run: |
# Automatically version the image by using the commit SHA
IMAGE_VERSION=$(echo $GITHUB_SHA | cut -c1-7)
echo "IMAGE_VERSION=$IMAGE_VERSION" >> $GITHUB_ENV # Use environment file instead of set-output
docker tag furkmak/legalapp:latest furkmak/legalapp:$IMAGE_VERSION
docker push furkmak/legalapp:latest
docker push furkmak/legalapp:$IMAGE_VERSION

0 comments on commit 6796421

Please sign in to comment.