Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- stages:
- - setup
- - install
- - build
- - deploy
- variables:
- NVM_DIR: "/home/riley45-sc/.nvm"
- NODE_VERSION: "18.20.4"
- setup:
- stage: setup
- script:
- - mkdir -p $NVM_DIR
- - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
- - export NVM_DIR="$HOME/.nvm"
- - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
- - nvm install $NODE_VERSION
- - nvm use $NODE_VERSION
- - nvm alias default $NODE_VERSION
- - node -v
- - npm -v
- install:
- stage: install
- script:
- - npm install
- artifacts:
- paths:
- - node_modules/
- build:
- stage: build
- script:
- - npm run build
- artifacts:
- paths:
- - dist/
- deploy:
- stage: deploy
- script:
- - eval $(ssh-agent -s)
- - echo "$SSH_PRIVATE_KEY_BASE64" | base64 -d > /tmp/ssh_private_key
- - chmod 600 /tmp/ssh_private_key
- - ssh-add /tmp/ssh_private_key
- - mkdir -p ~/.ssh
- - chmod 700 ~/.ssh
- - ssh-keyscan -H $VM_IPADDRESS >> ~/.ssh/known_hosts
- - chmod 644 ~/.ssh/known_hosts
- - scp package.json $SSH_USER@$VM_IPADDRESS:/tmp/package.json
- - scp package-lock.json $SSH_USER@$VM_IPADDRESS:/tmp/package-lock.json
- - ssh $SSH_USER@$VM_IPADDRESS "
- sudo rm -rf /var/www/html/node_modules &&
- sudo cp /tmp/package.json /var/www/html &&
- sudo cp /tmp/package-lock.json /var/www/html &&
- cd /var/www/html &&
- curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash &&
- source ~/.nvm/nvm.sh &&
- nvm install $NODE_VERSION &&
- nvm alias default $NODE_VERSION &&
- nvm use $NODE_VERSION &&
- sudo npm install -g npm@latest --unsafe-perm &&
- sudo npm cache clean --force &&
- sudo npm install --unsafe-perm &&
- sudo npm install -g astro@latest --unsafe-perm &&
- sudo npm run build --unsafe-perm"
- environment:
- name: production
- url: http://$VM_IPADDRESS
- only:
- - main
Add Comment
Please, Sign In to add comment