mirror of
https://github.com/alex289/CleanArchitecture.git
synced 2025-07-01 19:12:57 +00:00
feat: Improve ci/cd workflow
This commit is contained in:
parent
7e36fb7dd2
commit
2cb77f6f4b
29
.github/workflows/docker-image.yml
vendored
29
.github/workflows/docker-image.yml
vendored
@ -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
|
|
50
.github/workflows/dotnet.yml
vendored
50
.github/workflows/dotnet.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: CI
|
name: CI/CD
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
@ -7,25 +7,59 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
branches: [ main ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE: alexdev28/clean-architecture
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
env:
|
||||||
|
solutionFile: CleanArchitecture.sln
|
||||||
|
projectName: CleanArchitecture
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- 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
|
- name: Setup .NET
|
||||||
uses: actions/setup-dotnet@v3
|
uses: actions/setup-dotnet@v3
|
||||||
with:
|
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
|
- name: Restore dependencies
|
||||||
run: dotnet restore
|
run: dotnet restore
|
||||||
- name: Build
|
- name: Build
|
||||||
run: dotnet build --no-restore
|
run: dotnet build --no-restore
|
||||||
- name: Test
|
- name: Test
|
||||||
run: dotnet test --no-build --verbosity normal
|
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
|
Loading…
Reference in New Issue
Block a user