Updated Pipeline to publish backend automatically

This commit is contained in:
2025-02-28 16:04:43 +01:00
parent 204f1a3e1d
commit 1e5b17c4ef

View File

@@ -19,6 +19,12 @@ install-mobile:
paths:
- src/WorkTime.Mobile/node_modules
install-backend:
stage: install
image: mcr.microsoft.com/dotnet/sdk:9.0
script:
- dotnet restore
lint-mobile:
stage: lint
image: node:lts-alpine
@@ -65,6 +71,8 @@ build-backend:
paths:
- "**/bin/Release"
expire_in: 10 minutes
dependencies:
- install-backend
test-backend:
stage: test
@@ -86,20 +94,23 @@ publish-mobile:
script:
- export VERSION=$(echo $CI_COMMIT_TAG | sed 's/^v//')
- docker login -u leon.hoppe -p ${CI_REGISTRY_PASSWORD} registry.leon-hoppe.de
- docker build -t registry.leon-hoppe.de/leon.hoppe/worktime:$VERSION -t registry.leon-hoppe.de/leon.hoppe/worktime:latest .
- docker push registry.leon-hoppe.de/leon.hoppe/worktime:$VERSION
- docker push registry.leon-hoppe.de/leon.hoppe/worktime:latest
- docker build -t registry.leon-hoppe.de/leon.hoppe/worktime/mobile:$VERSION -t registry.leon-hoppe.de/leon.hoppe/worktime/mobile:latest .
- docker push registry.leon-hoppe.de/leon.hoppe/worktime/mobile:$VERSION
- docker push registry.leon-hoppe.de/leon.hoppe/worktime/mobile:latest
only:
- tags
publish-backend:
stage: publish
image: docker:latest
services:
- name: docker:dind
alias: docker
script:
- export VERSION=$(echo $CI_COMMIT_TAG | sed 's/^v//')
- dotnet pack -c Release -o . /p:Version=$VERSION
- for nupkg in *.nupkg; do dotnet nuget push $nupkg -k ${NUGET_API_KEY} -s https://api.nuget.org/v3/index.json; done
- docker login -u leon.hoppe -p ${CI_REGISTRY_PASSWORD} registry.leon-hoppe.de
- docker build -t registry.leon-hoppe.de/leon.hoppe/worktime/api:$VERSION -t registry.leon-hoppe.de/leon.hoppe/worktime/api:latest -f src/WorkTime.Api/Dockerfile .
- docker push registry.leon-hoppe.de/leon.hoppe/worktime/api:$VERSION
- docker push registry.leon-hoppe.de/leon.hoppe/worktime/api:latest
only:
- tags
dependencies:
- build-backend
- test-backend