diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml deleted file mode 100644 index 0d6af36..0000000 --- a/.github/workflows/docker-image.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: Docker Image CD - -on: - workflow_dispatch: - push: - branches: [ "main" ] - -env: - DOCKER_IMAGE: alexdev28/clean-architecture - -jobs: - docker: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - 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: -# platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ env.DOCKER_IMAGE }}:latest diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index f1585c6..153b3d2 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,4 +1,4 @@ -name: CI +name: CI/CD on: workflow_dispatch: @@ -7,25 +7,59 @@ on: pull_request: branches: [ main ] +env: + DOCKER_IMAGE: alexdev28/clean-architecture + jobs: build: - runs-on: ubuntu-latest + env: + solutionFile: CleanArchitecture.sln + projectName: CleanArchitecture steps: - uses: actions/checkout@v3 - - name: Dependency Review - uses: actions/dependency-review-action@v3 - with: - base-ref: ${{ github.event.pull_request.base.sha || 'main' }} - head-ref: ${{ github.event.pull_request.head.sha || github.ref }} - name: Setup .NET uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.x.x + dotnet-version: | + 7.x.x + 6.x.x + - name: Check for vulnerabilities + run: | + VERSION=$(curl -s https://jeremylong.github.io/DependencyCheck/current.txt) + curl -Ls "https://github.com/jeremylong/DependencyCheck/releases/download/v$VERSION/dependency-check-$VERSION-release.zip" --output dependency-check.zip + unzip dependency-check.zip + ./dependency-check/bin/dependency-check.sh -s "**/*.csproj" --project "${{ env.projectName }}" --failOnVCSS "7" + - name: Check for license issues + run: | + dotnet new tool-manifest + dotnet tool install --local liz.tool + dotnet liz "${{ env.solutionFile }}" --suppress-progressbar - name: Restore dependencies run: dotnet restore - name: Build run: dotnet build --no-restore - name: Test run: dotnet test --no-build --verbosity normal + + docker: + runs-on: ubuntu-latest + needs: build + if: github.ref == 'refs/heads/main' + steps: + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - 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: +# platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ env.DOCKER_IMAGE }}:latest \ No newline at end of file