Skip to content

Instantly share code, notes, and snippets.

@jessgusclark
Last active June 5, 2019 13:30
Show Gist options
  • Save jessgusclark/d670e42b3add1d4c58a932d4895ad849 to your computer and use it in GitHub Desktop.
Save jessgusclark/d670e42b3add1d4c58a932d4895ad849 to your computer and use it in GitHub Desktop.
React to Production Pipelines file
#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