Skip to content

Basic Set Up for Workout Service #1

Basic Set Up for Workout Service

Basic Set Up for Workout Service #1

Workflow file for this run

name: Workout Service CI/CD Pipeline
on:
push:
paths:
- backend/src/**
- .github/workflows/workout.yml
branches:
- master
- develop
tags:
- 'v*'
pull_request:
types: [opened, synchronize, reopened]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run reusable Build and Test action
uses: ./.github/actions/build-and-test
with:
backendCsprojPath: ./backend/src/WorkoutService/WorkoutService.Api/WorkoutService.Api.csproj
# unitTestsProjectPath: ./backend/tests/WorkoutService/WorkoutService.Domain.Tests/WorkoutService.Domain.Tests.csproj
# integrationTestsProjectPath: ./backend/tests/WorkoutService/WorkoutService.Application.Tests/WorkoutService.Application.Tests.csproj
buildConfiguration: Release
serviceName: WorkoutService
docker:
needs: build-and-test
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKER_HUB_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin
- name: Build Docker image
run: |
IMAGE_VERSION="latest"
if [[ "$GITHUB_REF" == refs/tags/* ]]; then
IMAGE_VERSION=${GITHUB_REF#refs/tags/}
fi
docker buildx build \
-t ${{ secrets.DOCKER_HUB_USERNAME }}/workout-service:${IMAGE_VERSION} \
-f ./backend/src/WorkoutService/Dockerfile \
./backend/src
- name: Push Docker image to Docker Hub
if: startsWith(github.ref, 'refs/tags/')
run: |
IMAGE_VERSION=${GITHUB_REF#refs/tags/}
docker push ${{ secrets.DOCKER_HUB_USERNAME }}/workout-service:${IMAGE_VERSION}