Files
pas/.gitlab-ci.yml
2025-07-27 17:31:08 +00:00

86 lines
2.1 KiB
YAML

stages: # Define the stages of the pipeline.
- build
#- test
- release
web-build: # This job runs in the build stage, which runs first.
stage: build
image: node:24
script:
- cd Web
- npm install
- npm run build
artifacts: # Artifacts are files that are passed between stages.
paths:
- Web/dist/Web/browser # The 'dist' directory will be available in the next stage.
when: on_success
access: all
expire_in: 30 days
api-build:
stage: build
image: mcr.microsoft.com/dotnet/sdk:8.0
script:
- cd Api
- dotnet publish Api.csproj --output ./build --runtime linux-x64 --configuration Release --self-contained true
artifacts:
paths:
- Api/build
when: on_success
access: all
expire_in: 30 days
semantic-release:
image: node:24
stage: release
script:
- apt update && apt install zip -y
- zip -r dist.zip Web/dist/Web/browser
- zip -r api.zip Api/build
- npm install --save-dev @semantic-release/gitlab
- npx semantic-release --debug
only:
- main
update_db:
image: mcr.microsoft.com/dotnet/sdk:8.0
stage: release
script:
- dotnet restore
- dotnet build
- dotnet ef database update --project Api/Api.csproj --startup-project Api/Api.csproj
variables:
ConnectionStrings__DefaultConnection: "Server=db;Database=CentrumDb;User=sa;Password=Your_password123;TrustServerCertificate=True;"
only:
- main
docker-build:
stage: release
image: docker:latest
services:
- name: docker:dind
alias: docker
variables:
DOCKER_DRIVER: overlay2
DOCKER_HOST: tcp://docker:2375
DOCKER_TLS_CERTDIR: ""
before_script:
- ip a
- docker info
script:
- docker build -t centrum-api:latest -f Api/Dockerfile .
docker-deploy:
stage: release
image: docker:latest
services:
- docker:dind
environment: production
tags:
- deployment
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
- docker tag centrum-api:latest $CI_REGISTRY_IMAGE:latest
- docker push $CI_REGISTRY_IMAGE:latest