Update #10
This file contains 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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: CI churchManager | |
on: | |
push: | |
branches: [ "main", "master", "ci" ] | |
pull_request: | |
branches: [ "main", "master", "ci" ] | |
env: | |
IMAGE_NAME: rodolfojesus/church-manager | |
jobs: | |
tests: | |
name: Tests | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
packages: write | |
actions: read | |
checks: read | |
pull-requests: read | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Restore API | |
run: dotnet restore ./Registration/src/Application/Registration.API/Registration.API.csproj | |
- name: Restore DI | |
run: dotnet restore ./Registration/src/Service/Registration.DependencyInjection/Registration.DependencyInjection.csproj | |
- name: Restore Package | |
run: dotnet restore ./Registration/src/Domain/Registration.CentralPackages/Registration.CentralPackages.csproj | |
- name: Restore DomainCore | |
run: dotnet restore ./Registration/src/Domain/Registration.DomainCore/Registration.DomainCore.csproj | |
- name: Restore DomainBase | |
run: dotnet restore ./Registration/src/Domain/Registration.DomainBase/Registration.DomainBase.csproj | |
- name: Restore Handlers | |
run: dotnet restore ./Registration/src/Service/Registration.Handlers/Registration.Handlers.csproj | |
- name: Restore Repository | |
run: dotnet restore ./Registration/src/Repository/Registration.Repository/Registration.Repository.csproj | |
- name: Restore Resources | |
run: dotnet restore ./Registration/src/Infrastructure/Registration.Resources/Registration.Resources.csproj | |
- name: Restore Mapper | |
run: dotnet restore ./Registration/src/Service/Registration.Mapper/Registration.Mapper.csproj | |
- name: Restore MessageBroker | |
run: dotnet restore ./Registration/src/Service/MessageBroker/MessageBroker.csproj | |
- name: Restore Infrastructure | |
run: dotnet restore ./Registration/src/Infrastructure/Registration.Infrastructure/Registration.Infrastructure.csproj | |
- name: Restore CloudServices | |
run: dotnet restore ./Registration/src/Service/CloudServices/CloudServices.csproj | |
- name: Build API | |
run: dotnet build ./Registration/src/Application/Registration.API/Registration.API.csproj --configuration Release | |
- name: Build DependencyInjection | |
run: dotnet build ./Registration/src/Service/Registration.DependencyInjection/Registration.DependencyInjection.csproj --configuration Release | |
- name: Build CentralPackages | |
run: dotnet build ./Registration/src/Domain/Registration.CentralPackages/Registration.CentralPackages.csproj --configuration Release | |
- name: Build DomainCore | |
run: dotnet build ./Registration/src/Domain/Registration.DomainCore/Registration.DomainCore.csproj --configuration Release | |
- name: Build DomainBase | |
run: dotnet build ./Registration/src/Domain/Registration.DomainBase/Registration.DomainBase.csproj --configuration Release | |
- name: Build Handlers | |
run: dotnet build ./Registration/src/Service/Registration.Handlers/Registration.Handlers.csproj --configuration Release | |
- name: Build Repository | |
run: dotnet build ./Registration/src/Repository/Registration.Repository/Registration.Repository.csproj --configuration Release | |
- name: Build Resources | |
run: dotnet build ./Registration/src/Infrastructure/Registration.Resources/Registration.Resources.csproj --configuration Release | |
- name: Build Mapper | |
run: dotnet build ./Registration/src/Service/Registration.Mapper/Registration.Mapper.csproj --configuration Release | |
- name: Build MessageBroker | |
run: dotnet build ./Registration/src/Service/MessageBroker/MessageBroker.csproj --configuration Release | |
- name: Build Infrastructure | |
run: dotnet build ./Registration/src/Infrastructure/Registration.Infrastructure/Registration.Infrastructure.csproj --configuration Release | |
- name: Build CloudServices | |
run: dotnet build ./Registration/src/Service/CloudServices/CloudServices.csproj --configuration Release | |
- name: Test | |
run: dotnet test ./Registration/src/Test/HandlerTest/HandlersTest.csproj | |
build: | |
name: Build and publish image | |
runs-on: ubuntu-latest | |
needs: tests | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Set BUILD_TAG | |
run: | | |
echo BUILD_TAG=$(echo ${{ github.head_ref || github.ref_name }} | sed "s,/,_,g")-${{ github.run_number }} >> $GITHUB_ENV | |
- name: Print BUILD_TAG defined | |
run: | | |
echo "Branch ---> ${{ github.head_ref || github.ref_name }}" | |
echo "Run number ---> ${{ github.run_number }}" | |
echo "Tag ---> ${{ env.BUILD_TAG }}" | |
- name: Log in to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUBUSERNAME }} | |
password: ${{ secrets.DOCKERHUBTOKEN }} | |
- name: Build and push Docker images | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./Registration | |
file: ./Registration/Dockerfile | |
push: true | |
tags: ${{ env.IMAGE_NAME }}:${{ env.BUILD_TAG }},${{ env.IMAGE_NAME }}:latest |