69 lines
1.7 KiB
YAML
69 lines
1.7 KiB
YAML
name: Portfolio CI/CD
|
|
|
|
on:
|
|
push:
|
|
branches: [ "*" ]
|
|
tags: [ "*" ]
|
|
pull_request:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '10.x'
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install dependencies
|
|
run: dotnet restore
|
|
|
|
- name: Build Projects
|
|
run: dotnet build --configuration Release --no-restore
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- name: Setup .NET
|
|
uses: actions/setup-dotnet@v4
|
|
with:
|
|
dotnet-version: '10.x'
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Test
|
|
run: dotnet test --verbosity normal
|
|
|
|
publish:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Pull LFS
|
|
run: git lfs pull
|
|
|
|
- name: Login to registry
|
|
run: |
|
|
echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login git.leon-hoppe.de \
|
|
-u leon.hoppe --password-stdin
|
|
|
|
- name: Build backend image
|
|
run: docker build -t git.leon-hoppe.de/leon.hoppe/portfolio/backend:latest -f src/Portfolio.Api/Dockerfile .
|
|
|
|
- name: Build frontend image
|
|
run: docker build -t git.leon-hoppe.de/leon.hoppe/portfolio/frontend:latest -f src/Portfolio.Web/Dockerfile .
|
|
|
|
- name: Push backend image
|
|
run: docker push git.leon-hoppe.de/leon.hoppe/portfolio/backend:latest
|
|
|
|
- name: Push frontend image
|
|
run: docker push git.leon-hoppe.de/leon.hoppe/portfolio/frontend:latest
|