Yes, best way is to create a "production" and "staging" branch for both environments and have different deployments for each branch.
Deploying from git to a stage and production environment
This is really a git question. Hope that is allowed here. I'm currently learnign Laravel and have created a first test project running locally.
I also have a location for the production version of the project and a basic Github-based deployment workflow: when I have tested code changes locally, I push them to a Github repo, which get deployed by SSH to the production server using Github Actions.
However, I would also like to have a staging environment for the project that is online, on a separate server. The idea being that I first test code changes locally; then push them to the staging environment and run some tests; and if that all checks out, I push to the production environment.
I still don't really understand branching and tagging in Git. What are some good ways to do this? Does one create a "production" and a "staging" branch and push to each?
I know (or can find out) how to setup a Github Action to deploy from a tag or branch. My question really is about how to organize this within git so I can easily push a change to the staging environment, and as easily to production.
Would appreciate a step-by-step explanation, or any pointers to tutorials...
@pekkagaiser https://youtu.be/AmScEC-_72I this is my video on the topic.
In simple situation, in short.
- You create a new branch "develop" from main/master
- Locally you only work with develop branch and push its changes
- Separate server/environment to test the code by deploying from that develop branch
- When you feel it's tested and ready to go live, pull request from develop to main/master, merge it and then deploy to live, from main/master.
Please or to participate in this conversation.
