repo-reviews / repo-reviews.github.io

Support the community with a helpful ❤️ repo review ❤️
https://repo-reviews.github.io/
Creative Commons Zero v1.0 Universal
12 stars 27 forks source link

add documentation for development, jekyll #4

Open repo-reviews opened 1 year ago

repo-reviews commented 1 year ago

The below work from https://github.com/github/government.github.com should be helpful:


To Set up Locally

You can take all the files of this site and run them just on your computer as if it were live online, only it's just on your machine.

Requirements

If you have installed GitHub Desktop, Git was also installed automatically.

To copy the repository's files from here onto your computer and to view and serve those files locally, at your computer's command line type:

git clone https://github.com/github/government.github.com.git
cd government.github.com
script/bootstrap
script/server

Open http://localhost:4000 in your browser

Deploying

government.github.com now utilizes a two-repo approach to managing staging and production deployments:

For small changes, you can deploy right to production by merging a pull request. For larger changes, push your branch to the staging repo from Terminal. Here's how to setup staging and deploy to it:

$ script/stage staging

This script will generate the government site (without starting the local server) and prep it for staging. It does this by creating a temporary Git repo within the compiled _site directory and force pushing that to a separate remote repo (in this case, https://ghe.io/government/staging).

Pushing to the staging repo requires authenticating with GitHub via Terminal. You'll be asked for a username and password when running script/stage. Use your GHE.io username and, since we enforce 2FA, use a personal access token as your password.

_Having trouble deploying to a staging server? Delete the entire _site directory and try again. Sometimes the temporary Git repository we make in the script can go awry._

When you're done with staging and your pull request has been approved, you can merge your branch. Your changes will be automatically deployed to the production site in a few minutes.


repo-reviews commented 1 year ago

So far this installs the requirements, but not seeing the site on GCP VM Ubuntu 20.04 LTS:

sudo apt update
# following https://jekyllrb.com/docs/installation/ubuntu/
sudo apt-get install ruby-full build-essential zlib1g-dev
echo '# Install Ruby Gems to ~/gems' >> ~/.bashrc
echo 'export GEM_HOME="$HOME/gems"' >> ~/.bashrc
echo 'export PATH="$HOME/gems/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
gem install jekyll bundler
# install node.js
sudo apt install nodejs
# following To Set up Locally instructions
git clone https://github.com/github/government.github.com.git
cd government.github.com
script/bootstrap
script/server