Skip to content

Use GitHub Actions and Workflows to build and deploy your applications to a branch. So you can just pull this branch to deploy on the production server, without building.

License

Notifications You must be signed in to change notification settings

ActionsHackathon21/deploy-to-git-branch

Repository files navigation

Deploy application to GIT branch

This project follows the DEV.to #ActionsHackathon21 hackathon.

Use GitHub Actions and Workflows to build and deploy your applications to a branch. So you can just pull this branch to deploy on the production server, without building. You can also use it to deploy to Github Pages, by selecting the destination branch as the Github Pages's branch.

Screenshot

Check the complete workflow here (build-and-deploy-to-branch.yml)

Actions used

(Also actions/setup-node@v2 for setup nodejs, although it's not required)

Configurations

  • You can config the deployment branch postfix, with DEPLOY_BRANCH_POSTFIX variable. So the code on "main" branch will be built and pushed into main-<DEPLOY_BRANCH_POSTFIX> branch
  • You can also configure the branches which you want to run this workflow, with branches key.

Flows

In this repository, I use a sample NextJS to demonstrate. However you can change the workflow a bit to fit your project.

  • Use actions/checkout@v2 to checkout source code from the repository
  • Use actions/setup-node@v2 to setup nodejs
  • Use actions/cache@v2 to cache dependencies (node_modules and .yarn directories)
  • Install dependencies with yarn
  • Run tests
  • Build application
  • Synchronize built files with deployment branch
  • Push build into the deployment branch

About

Use GitHub Actions and Workflows to build and deploy your applications to a branch. So you can just pull this branch to deploy on the production server, without building.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published