56 lines
1.4 KiB
YAML
56 lines
1.4 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
|
|
parallel: 2
|
|
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.
|
|
|
|
api-build:
|
|
stage: build
|
|
image: mcr.microsoft.com/dotnet/sdk:8.0
|
|
parallel: 2
|
|
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
|
|
|
|
deploy-job: # This job runs in the deploy stage.
|
|
stage: release # It only runs when *both* jobs in the test stage complete successfully.
|
|
environment: production
|
|
tags:
|
|
- deployment
|
|
script:
|
|
- cp -ir Web/dist/Web/browser/* /var/www/html
|
|
- systemctl stop api.service
|
|
- cp -ir Api/build/* /var/api
|
|
- systemctl start api.service
|
|
- echo "Application successfully deployed."
|