Files
usbcheck.it/.gitlab-ci.yml

62 lines
1.1 KiB
YAML

stages: [install, build, deploy]
variables:
NODE_ENV: production
cache:
paths:
- node_modules/
install:
stage: install
image: node:20-alpine
script:
- corepack enable
- pnpm install --frozen-lockfile
artifacts:
paths:
- node_modules/
build:
stage: build
image: node:20-alpine
script:
- pnpm build
artifacts:
paths:
- dist/
.deploy_template: &deploy
stage: deploy
image: alpine:3.20
before_script:
- apk add --no-cache openssh-client rsync
- mkdir -p ~/.ssh
- echo "$SSH_PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_ed25519
- chmod 600 ~/.ssh/id_ed25519
script:
- rsync -az --delete dist/ "$DEPLOY_USER@$DEPLOY_HOST:$DEPLOY_PATH"
only: []
deploy:staging:
<<: *deploy
variables:
DEPLOY_PATH: $DEPLOY_PATH_STAGING
environment:
name: staging
url: https://staging.usbcheck.it
only:
- develop
- merge_requests
deploy:production:
<<: *deploy
variables:
DEPLOY_PATH: $DEPLOY_PATH_PROD
environment:
name: production
url: https://usbcheck.it
only:
- main
when: manual