agir

ArtoJS CI

Aug 15th, 2024
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. stages:
  2. - setup
  3. - install
  4. - build
  5. - deploy
  6.  
  7. variables:
  8. NVM_DIR: "/home/riley45-sc/.nvm"
  9. NODE_VERSION: "18.20.4"
  10.  
  11. setup:
  12. stage: setup
  13. script:
  14. - mkdir -p $NVM_DIR
  15. - curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  16. - export NVM_DIR="$HOME/.nvm"
  17. - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
  18. - nvm install $NODE_VERSION
  19. - nvm use $NODE_VERSION
  20. - nvm alias default $NODE_VERSION
  21. - node -v
  22. - npm -v
  23.  
  24. install:
  25. stage: install
  26. script:
  27. - npm install
  28. artifacts:
  29. paths:
  30. - node_modules/
  31.  
  32. build:
  33. stage: build
  34. script:
  35. - npm run build
  36. artifacts:
  37. paths:
  38. - dist/
  39.  
  40. deploy:
  41. stage: deploy
  42. script:
  43. - eval $(ssh-agent -s)
  44. - echo "$SSH_PRIVATE_KEY_BASE64" | base64 -d > /tmp/ssh_private_key
  45. - chmod 600 /tmp/ssh_private_key
  46. - ssh-add /tmp/ssh_private_key
  47. - mkdir -p ~/.ssh
  48. - chmod 700 ~/.ssh
  49. - ssh-keyscan -H $VM_IPADDRESS >> ~/.ssh/known_hosts
  50. - chmod 644 ~/.ssh/known_hosts
  51. - scp package.json $SSH_USER@$VM_IPADDRESS:/tmp/package.json
  52. - scp package-lock.json $SSH_USER@$VM_IPADDRESS:/tmp/package-lock.json
  53. - ssh $SSH_USER@$VM_IPADDRESS "
  54. sudo rm -rf /var/www/html/node_modules &&
  55. sudo cp /tmp/package.json /var/www/html &&
  56. sudo cp /tmp/package-lock.json /var/www/html &&
  57. cd /var/www/html &&
  58. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash &&
  59. source ~/.nvm/nvm.sh &&
  60. nvm install $NODE_VERSION &&
  61. nvm alias default $NODE_VERSION &&
  62. nvm use $NODE_VERSION &&
  63. sudo npm install -g npm@latest --unsafe-perm &&
  64. sudo npm cache clean --force &&
  65. sudo npm install --unsafe-perm &&
  66. sudo npm install -g astro@latest --unsafe-perm &&
  67. sudo npm run build --unsafe-perm"
  68. environment:
  69. name: production
  70. url: http://$VM_IPADDRESS
  71. only:
  72. - main
  73.  
Add Comment
Please, Sign In to add comment