image: node:16 stages: - build - deploy .documentation-setup: before_script: - cd docs - chmod +x ./scripts/i18n-filter.sh - ./scripts/i18n-filter.sh src - npm install cache: key: files: - docs/package-lock.json paths: - docs/node_modules # This job only serves for validating that the docs builds correctly on all non deployment branches build: extends: .documentation-setup stage: build script: - npm run build except: - main - beta - alpha build-production: extends: .documentation-setup stage: build environment: name: production url: https://docs.castopod.org/ script: - npm run build artifacts: paths: - docs/.vitepress/dist expire_in: 30 mins only: - main - beta - alpha deploy: stage: deploy environment: name: production url: https://docs.castopod.org/ variables: HOST: $DOCS_HOST USER: $DOCS_USER TEMP_DIRECTORY: $DOCS_TEMP_DIRECTORY DIRECTORY: $DOCS_DIRECTORY SSH_PORT: 3242 SOURCE_FOLDER: "docs/.vitepress/dist/" before_script: # install rsync for file transfers - apt-get update && apt-get install rsync -y # Run ssh-agent (inside the build environment) - eval $(ssh-agent -s) # Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store - ssh-add <(echo "$SSH_PRIVATE_KEY" | base64 --decode) - mkdir -p ~/.ssh - '[[ -f /.dockerenv ]] && echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config' script: - rsync -avzuh -e "ssh -p $SSH_PORT" $SOURCE_FOLDER $USER@$HOST:$TEMP_DIRECTORY --progress - ssh $USER@$HOST -p $SSH_PORT "rsync -rtv $TEMP_DIRECTORY $DIRECTORY" only: - main - beta - alpha