-
Notifications
You must be signed in to change notification settings - Fork 0
add gh deploy script for any dev #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
0f858f4
b4dd454
8595d4f
a66cc8c
13f1793
8376bf6
f44efee
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,51 @@ | ||||||||||||||
| name: Deploy Website | ||||||||||||||
|
|
||||||||||||||
| on: | ||||||||||||||
| pull_request: | ||||||||||||||
| branches: | ||||||||||||||
| - main | ||||||||||||||
| types: | ||||||||||||||
| - opened | ||||||||||||||
| - synchronize | ||||||||||||||
| - reopened | ||||||||||||||
|
|
||||||||||||||
| concurrency: | ||||||||||||||
| group: deploy-preview | ||||||||||||||
| cancel-in-progress: true | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| deploy: | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
|
|
||||||||||||||
| steps: | ||||||||||||||
| - name: Deploy to server | ||||||||||||||
| uses: appleboy/ssh-action@v1 | ||||||||||||||
| with: | ||||||||||||||
| host: ${{ secrets.SERVER_HOST }} | ||||||||||||||
| username: ${{ secrets.SERVER_USER }} | ||||||||||||||
| key: ${{ secrets.SERVER_SSH_KEY }} | ||||||||||||||
| script: | | ||||||||||||||
| export NVM_DIR="$HOME/.nvm" | ||||||||||||||
| [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" | ||||||||||||||
|
|
||||||||||||||
| DEPLOY_DIR=/opt/loglife/preview | ||||||||||||||
| APP_NAME=loglife-preview | ||||||||||||||
| PORT=3001 | ||||||||||||||
|
||||||||||||||
| DEPLOY_DIR=/opt/loglife/preview | |
| APP_NAME=loglife-preview | |
| PORT=3001 | |
| DEPLOY_DIR=/opt/loglife/preview-${{ github.event.pull_request.number }} | |
| APP_NAME=loglife-preview-${{ github.event.pull_request.number }} | |
| PORT=$((3000 + ${{ github.event.pull_request.number }})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
git reset --hard will discard any uncommitted changes or failed deployment artifacts without verification
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add error handling to prevent starting the server if build fails - consider adding set -e at the start of the script
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concurrency group should include PR number to prevent different PRs from canceling each other's deployments