Skip to content

Commit b7cb993

Browse files
committed
Add deployment automation
1 parent 5864b92 commit b7cb993

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
######################
33
/*.db
44
.DS_Store
5+
.vscode
56

67
# Config and output files #
78
###########################

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,20 @@ To build locally, you need Ruby 2, Bundler 1, and the following commands:
3030
```
3131
rake preview:all
3232
```
33+
34+
## Deployment
35+
36+
This branch is built and pushed to the gh-pages branch manually.
37+
38+
To build and deploy the branch, run:
39+
40+
```
41+
rake build_and_deploy
42+
```
43+
44+
This command runs the build, moves the generated content to the gh-pages branch, and pushes it to GitHub.
45+
Note, that you need to set up a remote named `public` that points to https://github.com/magento/devdocs.
46+
47+
The task creates a commit like `Deploy 7gjj0dkh`, where `7gjj0dkh` is an SHA of the source commit from the `archived-docs` branch. This will help in future debugging in case of any issues.
48+
After you push the updated gh-pages branch, it is deployed automatically through the GitHub pages environment to <http://magento.github.io/devdocs/>.
49+
You can track progress and status of deployment in [deployment history](https://github.com/magento/devdocs/deployments/activity_log?environment=github-pages) of the github-pages environment.

Rakefile

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,30 @@ end
3939
desc 'Build the entire website'
4040
task build_and_deploy: %w[clean] do
4141
print 'Building the site with Jekyll: $ '.magenta
42+
4243
# Check for uncommitted messages
4344
abort "\nCannot checkout. The branch contains uncommitted messages.".red unless `git status --short`.empty?
4445

4546
# Back up an environmental variable
4647
jekyll_env = ENV['JEKYLL_ENV']
4748
ENV['JEKYLL_ENV'] = 'production'
49+
# Build the site
4850
jekyll('build --verbose --baseurl=/devdocs')
4951
# Restore the environmental variable
5052
ENV['JEKYLL_ENV'] = jekyll_env
5153

5254
# Remember the SHA of the built commit
5355
commit = `git log --pretty=format:"%h" -1`
56+
57+
# Deploy the site
5458
`git checkout gh-pages`
5559
`cp -R _site/ ./`
5660
`git add --all`
5761
`git commit --message "Deploy #{commit}"`
58-
# `git push public`
62+
`git push public`
63+
`git checkout -`
5964

60-
puts 'Built!'.green
65+
puts 'Done!'.green
6166
end
6267

6368
desc 'Checkout to the master branch'

0 commit comments

Comments
 (0)