-
Notifications
You must be signed in to change notification settings - Fork 25
CI/CD PIPELINE WITH GITHUB ACTIONS #60
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
Open
brendobrendo
wants to merge
26
commits into
master
Choose a base branch
from
feature/gitworkflow
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
0bd5796
eslint fix for vm
brendobrendo d494ad5
created deploy gitaction
brendobrendo 5e43efc
commit test
brendobrendo ec716a3
ssh access to vm
brendobrendo f4e0177
deploy to vm test
brendobrendo 2949cd2
deploy test 2
brendobrendo 7974420
deploy test 3
brendobrendo 16e3785
deploy test 4
brendobrendo 8d4868e
test deploy 5
brendobrendo e1c8930
test deploy 6
brendobrendo ed58b16
test deploy 7
brendobrendo 7841ec9
test deploy 8
brendobrendo 183df06
test deploy 9
brendobrendo 80c2b99
test deploy 10
brendobrendo 4482f26
test deploy 11
brendobrendo 52534a7
test deploy 12
brendobrendo b01b64d
test deploy 13
brendobrendo 8f0ea1f
test deploy 13 - check node v
brendobrendo 17c58ea
test deploy 14 - use nvm
brendobrendo 5068ef2
test deploy 15 - install node and nvm
brendobrendo 6a1d48b
test deploy 16 - take out nvm use
brendobrendo 665fa58
test deploy 17 - check node version in build stage
brendobrendo 54aec10
nvm in build stage fix
brendobrendo 4115d49
test need for nvm use in Install stage
brendobrendo 0dab225
brendan portal 3
brendobrendo 99aafe2
Update to run on PR mergest to the master branch
brendobrendo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| name: Build and Deploy to the Admin Portal VM | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - master | ||
| types: [closed] | ||
|
|
||
| jobs: | ||
| deploy: | ||
| if: github.event.pull_request.merged == true | ||
| runs-on: ubuntu-20.04 | ||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Set up SSH key | ||
| run: | | ||
| mkdir -p ~/.ssh | ||
| echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa | ||
| chmod 600 ~/.ssh/id_rsa | ||
| ssh-keyscan -t rsa $VM_IP >> ~/.ssh/known_hosts | ||
| env: | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| VM_IP: ${{ secrets.VM_IP }} | ||
|
|
||
| - name: Install nvm | ||
| run: | | ||
| curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash | ||
| source ~/.nvm/nvm.sh | ||
| nvm install 19 | ||
|
|
||
| - name: Update code on VM | ||
| run: ssh $VM_USERNAME@$VM_IP "cd /home/githubactionuser/banana-admin && git pull origin feature/gitworkflow" | ||
| env: | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| VM_IP: ${{ secrets.VM_IP }} | ||
| VM_USERNAME: ${{ secrets.VM_USERNAME }} | ||
|
|
||
| - name: Check node version | ||
| run: ssh $VM_USERNAME@$VM_IP "cd /home/githubactionuser/banana-admin" | ||
| env: | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| VM_IP: ${{ secrets.VM_IP }} | ||
| VM_USERNAME: ${{ secrets.VM_USERNAME }} | ||
|
|
||
| - name: Build code on VM | ||
| run: ssh $VM_USERNAME@$VM_IP "cd /home/githubactionuser/banana-admin && source ~/.nvm/nvm.sh && nvm use 19 && yarn run build" | ||
| env: | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| VM_IP: ${{ secrets.VM_IP }} | ||
| VM_USERNAME: ${{ secrets.VM_USERNAME }} | ||
|
|
||
| - name: Restart Nginx server | ||
| run: ssh $VM_USERNAME@$VM_IP "sudo systemctl restart nginx" | ||
| env: | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | ||
| VM_IP: ${{ secrets.VM_IP }} | ||
| VM_USERNAME: ${{ secrets.VM_USERNAME }} | ||
|
|
||
| - name: Clean up SSH key | ||
| run: | | ||
| rm -f ~/.ssh/id_rsa | ||
| env: | ||
| SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Once you switch this back to
BANANA PORTAL, you can go ahead and merge it!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.
@brendobrendo @tackc yep I agree, looks good 🚀