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