-
Jacopo Gasparetto authoredJacopo Gasparetto authored
.gitlab-ci.yml 3.95 KiB
stages:
- fetch-version
- build
- test
- release
- upload
variables:
PACKAGENAME: frontend-s3
fetch-next-version:
stage: fetch-version
image: node:19
script:
- npm install @semantic-release/gitlab @semantic-release/exec @semantic-release/git
- npx semantic-release --generate-notes false --dry-run
artifacts:
paths:
- version.txt
only:
refs:
- main
- dev
- /^(([0-9]+)\.)?([0-9]+)\.x/ # Maintenance branches
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ # Prerelease branches
generate-dummy-version:
stage: fetch-version
script:
- echo build-${CI_PIPELINE_ID} > version.txt
artifacts:
paths:
- version.txt
except:
refs:
- main
- dev
- /^(([0-9]+)\.)?([0-9]+)\.x/ # Maintenance branches
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ # Prerelease branches
build-backend:
stage: build
image: docker:latest
services:
- docker:dind
before_script:
- docker login -u gitlab-ci-token -p ${CI_JOB_TOKEN} ${CI_REGISTRY}
- VERSION="$(cat version.txt)"
script:
- docker build --pull -t "${CI_REGISTRY_IMAGE}/backend:v${VERSION}" backend
- docker push "${CI_REGISTRY_IMAGE}/backend:v${VERSION}"
only:
changes:
- .gitlab-ci.yml
- backend/**/*
build-frontend:
stage: build
image: node:19-slim
before_script:
- apt update && apt install -y jq
- VERSION="$(cat version.txt)"
- PACKAGENAME="$(jq -r '.name' frontend/package.json)"
- echo "$(jq '.version="'"${VERSION}"'"' frontend/package.json)" > frontend/package.json
- echo ${PACKAGENAME} > packagename.txt
- cd frontend
script:
- npm ci
- npm run build
- npm run compress