Files
WorkTime/.gitlab-ci.yml
2025-02-28 15:56:27 +01:00

106 lines
2.3 KiB
YAML

stages:
- install
- lint
- build
- test
- publish
install-mobile:
stage: install
image: node:lts-alpine
before_script:
- cd src/WorkTime.Mobile
script:
- npm install --prefer-offline
cache:
key:
files:
- src/WorkTime.Mobile/package.json
paths:
- src/WorkTime.Mobile/node_modules
lint-mobile:
stage: lint
image: node:lts-alpine
needs: ["install-mobile"]
before_script:
- cd src/WorkTime.Mobile
script:
- npm run lint
cache:
key:
files:
- src/WorkTime.Mobile/package.json
paths:
- src/WorkTime.Mobile/node_modules
policy: pull
build-mobile:
stage: build
image: node:lts-alpine
needs: ["lint-mobile"]
before_script:
- cd src/WorkTime.Mobile
script:
- npm run build
artifacts:
paths:
- $CI_PROJECT_DIR/src/WorkTime.Mobile/www
expire_in: 10 minutes
cache:
key:
files:
- src/WorkTime.Mobile/package.json
paths:
- src/WorkTime.Mobile/node_modules
policy: pull
build-backend:
stage: build
image: mcr.microsoft.com/dotnet/sdk:9.0
script:
- dotnet restore
- dotnet build --configuration Release --no-restore
artifacts:
paths:
- "**/bin/Release"
expire_in: 10 minutes
test-backend:
stage: test
image: mcr.microsoft.com/dotnet/sdk:9.0
script:
- dotnet test --verbosity normal
dependencies:
- build-backend
publish-mobile:
stage: publish
needs: ["build-mobile"]
image: docker:latest
services:
- name: docker:dind
alias: docker
before_script:
- cd src/WorkTime.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
only:
- tags
publish-backend:
stage: publish
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
only:
- tags
dependencies:
- build-backend
- test-backend