-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat(ci): homelab deploy #322
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Reviewer's Guide by SourceryThis pull request introduces a new GitHub Actions workflow for deploying to a homelab environment. The workflow is triggered on various events including pushes to the main branch, releases, pull requests, and manual dispatches. It uses Tailscale for secure network access and SSH for executing build and service restart commands on the remote machine. File-Level Changes
Tips
|
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.
Hey @duyet - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 1 issue found
- 🟡 Security: 2 issues found
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
|
||
permissions: | ||
contents: read | ||
id-token: write |
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.
🚨 suggestion (security): Consider limiting the scope of the id-token permission.
The 'id-token: write' permission is quite powerful and should be used with caution. If possible, consider limiting its scope to only the necessary actions to minimize security risks.
id-token: write | |
permissions: | |
contents: read | |
id-token: write:actions |
.github/workflows/homelab.yml
Outdated
MACHINE_IP="$(tailscale ip -6 $MACHINE)" | ||
ssh-keyscan $MACHINE_IP >> ~/.ssh/known_hosts |
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.
issue: Check for potential issues with IPv6-only addresses.
The use of 'tailscale ip -6' assumes that the machine has an IPv6 address. If the machine does not have an IPv6 address, this could cause issues. Consider adding a fallback to IPv4 or handling the case where an IPv6 address is not available.
.github/workflows/homelab.yml
Outdated
|
||
- run: | | ||
MACHINE_IP="$(tailscale ip -6 $MACHINE)" | ||
ssh -i ~/.ssh/key "github@$MACHINE_IP" "NODE_VERSION=v22.5.1 /home/duyet/.nvm/nvm-exec yarn build" |
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.
🚨 suggestion (security): Consider using a more secure method for SSH key management.
Storing the SSH key in a file and using it directly can be risky. Consider using an SSH agent or another secure method to manage the SSH key.
ssh -i ~/.ssh/key "github@$MACHINE_IP" "NODE_VERSION=v22.5.1 /home/duyet/.nvm/nvm-exec yarn build" | |
eval "$(ssh-agent -s)" | |
ssh-add ~/.ssh/key | |
ssh "github@$MACHINE_IP" "NODE_VERSION=v22.5.1 /home/duyet/.nvm/nvm-exec yarn build" |
Summary by Sourcery
This pull request introduces a new GitHub Actions workflow for deploying to a homelab environment. The workflow includes steps for setting up Tailscale, adding an SSH key, and executing remote commands to build the project and restart a service.