Last active
June 5, 2019 13:30
-
-
Save jessgusclark/d670e42b3add1d4c58a932d4895ad849 to your computer and use it in GitHub Desktop.
React to Production Pipelines file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#bitbucket-pipelines.yml | |
image: node:10.15.3 | |
pipelines: | |
default: | |
- step: | |
name: Build React Project | |
script: | |
- npm install | |
- npm run-script build | |
- mkdir packaged | |
- tar -czvf packaged/package-${BITBUCKET_BUILD_NUMBER}.tar.gz -C build . | |
artifacts: | |
- packaged/** | |
- step: | |
name: Deploy to Web | |
image: alpine | |
trigger: manual | |
deployment: production | |
script: | |
- mkdir upload | |
- tar -xf packaged/package-${BITBUCKET_BUILD_NUMBER}.tar.gz -C upload | |
- apk update && apk add openssh rsync | |
- rsync -a -e "ssh -o StrictHostKeyChecking=no" --delete upload/ $USERNAME@$SERVER:html/temp/react-${BITBUCKET_BUILD_NUMBER} | |
- ssh -o StrictHostKeyChecking=no $USERNAME@$SERVER "rm -r html/www" | |
- ssh -o StrictHostKeyChecking=no $USERNAME@$SERVER "mv 'html/temp/react-${BITBUCKET_BUILD_NUMBER}' 'html/www'" | |
- ssh -o StrictHostKeyChecking=no $USERNAME@$SERVER "chmod -R u+rwX,go+rX,go-w html/www" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment