xyter/.gitlab-ci.yml
Vermium Sifell db93f72127 ci: 🧑‍💻 improve ci job
Improved ci job by moving before_script into build
2023-10-01 17:10:35 +02:00

51 lines
1.3 KiB
YAML

stages:
- build
- docker
variables:
NODE_VERSION: "20"
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- ~/.npm/
build:
stage: build
before_script:
- apk update && apk add git tar nodejs npm
- npm ci
script:
- npm run build
- npx semantic-release
- find . -not -path "./node_modules/*" -type f -print0 | xargs -0 tar -czvf build-artifacts.tar.gz
artifacts:
paths:
- build-artifacts.tar.gz
only:
- merge_requests
- pushes
docker:
stage: docker
image: docker:stable
before_script:
- docker info
script:
- apk add tar
- tar -xzvf build-artifacts.tar.gz
- echo $DOCKERHUB_TOKEN | docker login --username $DOCKERHUB_USERNAME --password-stdin
# Tag name
- docker build -t zyner/xyter:$CI_COMMIT_TAG .
- docker push zyner/xyter:$CI_COMMIT_TAG
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY/zyner/xyter/bot:$CI_COMMIT_TAG .
- docker push $CI_REGISTRY/zyner/xyter/bot:$CI_COMMIT_TAG
# Latest
- docker build -t zyner/xyter:latest .
- docker push zyner/xyter:latest
- docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
- docker build -t $CI_REGISTRY/zyner/xyter/bot:latest .
- docker push $CI_REGISTRY/zyner/xyter/bot:latest
only:
- tags