Skip to content

Commit

Permalink
Build site at 2023-08-22 06:08:10 UTC
Browse files Browse the repository at this point in the history
  • Loading branch information
alvinsunyixiao committed Aug 22, 2023
1 parent c43ad49 commit 05b743f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 15 deletions.
27 changes: 13 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,33 @@ The ASL's website, hosted on GitHub Pages!

## System Setup
Before developing/publishing the website, you may need to install various system dependencies, specifically `rake` (a build automation tool) and `bundler` (a Ruby dependency manager, which will install all further dependencies listed in [`Gemfile`](Gemfile)). On a Ubuntu system, installing these dependencies looks something like
```shell
```sh
sudo apt install rake ruby-dev
sudo gem install bundler
bundle install # from the base directory of a cloned repository
```

## Developing the Website
To develop, **you must do your work on the `source` branch**. `master` is autogenerated via a `rake` job (you can see the details in `Rakefile`). The `source` branch contains all the Jekyll code. To do this, simply execute
```shell
git checkout source
And then `cd` into where you cloned this repository and run the following to install website
dependencies with bundler
```sh
bundle config set --local path 'vendor/bundle'
bundle install
```

Additional **high-level** commands include
```shell
## Developing the Website
**High-level** commands include
```sh
rake preview # <- asks jekyll to build the site and host it locally
```
Additional **low-level** commands include
```shell
**Low-level** commands include
```sh
rake check # <- checks whether the local repo is up to date
rake build # <- asks jekyll to build the site from its source
rake deploy # <- copies generated website from source to master
```

## Publishing the Website
When you've made the desired changes and are in the `source` branch, simply execute:
When you've made the desired changes, simply execute:
```shell
rake publish
```
This will rebuild the site, commit your changes to the `source` branch, and deploy the generated site (located in `_site`) to the `master` branch. GitHub Pages will pick up on this change and update `stanfordasl.github.io` with the new changes.
This will rebuild the site, commit your changes to the `main` branch, and deploy the generated site to `stanfordasl.github.io` with the new changes.

**NOTE**: This GitHub Pages link is where the `asl.stanford.edu` and `asl-origin.stanford.edu` proxies point to, so this repository and the corresponding GitHub Page is the "actual" website.
31 changes: 30 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
desc "Check git status"
task :check do
puts "\n## Checking that current branch is 'main'"
status = system('[ "$(git branch --show-current)" = "main" ]')
status ? puts("SUCCESS") : abort("`rake` commands must be run from the 'main' branch!`")
puts "\n## Checking that working copy is up-to-date with remote"
status = system(
"[ $(git rev-parse HEAD) = $(git ls-remote $(git rev-parse --abbrev-ref @{u} | sed 's|/| |g') | cut -f1) ]")
status ? puts("SUCCESS") :
abort("Your working copy (local) is not up-to-date with remote; `git pull` and merge as necessary")
end

desc "Git push"
task :commit do
puts "\n## Staging modified files"
status = system("git add -A")
status ? puts("SUCCESS") : abort("FAILED")
puts "\n## Committing a site build at #{Time.now.utc}"
message = "Build site at #{Time.now.utc}"
status = system("git commit -m \"#{message}\"")
status ? puts("SUCCESS") : abort("FAILED")
puts "\n## Pushing commits to remote"
status = system("git push origin main")
status ? puts("SUCCESS") : abort("FAILED")
end

desc "Build _site/ for production"
task :build do
puts "\n## Building Jekyll to _site/"
status = system("JEKYLL_ENV=production bundle exec jekyll build")
status ? puts("SUCCESS") : abort("FAILED")
end

desc "Preview _site/ for production"
desc "Preview _site/"
task :preview do
puts "\n## Previewing Jekyll to _site/"
status = system("bundle exec jekyll serve")
status ? puts("SUCCESS") : abort("FAILED")
end

desc "Build source and commit"
task :publish => [:check, :build, :check, :commit] do
end

0 comments on commit 05b743f

Please sign in to comment.