Skip to content

Commit cf11471

Browse files
committed
more complete setup instructions
closes #1
1 parent c690ae4 commit cf11471

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

readme.md

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,27 @@ This is a script for deploying generated files to a git branch, such as when bui
33
For an example of use, see [X1011/verge-mobile-bingo](https://github.com/X1011/verge-mobile-bingo).
44

55
## configuration
6-
Edit these variables at the top of the script to fit your project:
6+
Download the script (`wget https://github.com/X1011/git-directory-deploy/raw/master/deploy.sh && chmod +x deploy.sh`) and edit these variables within it as needed to fit your project:
77

88
- **deploy_directory**: root of the tree of files to deploy
99
- **deploy_branch**: branch to commit files to and push to origin
1010
- **default_username**, **default_email**: identity to use for git commits if none is set already. Useful for CI servers.
11-
- **repo**: (optional) repository to deploy to. Must be readable and writable. The default of "origin" will not work on Travis CI, since it uses the read-only git protocol. In that case, it is recommended to store a [GitHub token](https://help.github.com/articles/creating-an-access-token-for-command-line-use) in a [secure environment variable](http://about.travis-ci.org/docs/user/build-configuration/#Secure-environment-variables) and use it in an HTTPS URL like this: <code>repo=https://$GITHUB_TOKEN@github.com/<i>user</i>/<i>repo</i>.git</code>
11+
- **repo**: repository to deploy to. Must be readable and writable. The default of "origin" will not work on Travis CI, since it uses the read-only git protocol. In that case, it is recommended to store a [GitHub token](https://help.github.com/articles/creating-an-access-token-for-command-line-use) in a [secure environment variable](http://about.travis-ci.org/docs/user/build-configuration/#Secure-environment-variables) and use it in an HTTPS URL like this: <code>repo=https://$GITHUB_TOKEN@github.com/<i>user</i>/<i>repo</i>.git</code>
1212

1313
## setup
14-
Do this once to prepare your repository. This could be implemented in the script, but I don’t feel like doing it. Replace "dist" with your deploy_directory and "gh-pages" with your deploy_branch.
14+
Do this once to set up a deploy branch if you don't already have one. This could be implemented in the script, but I don’t feel like doing it. Replace "dist" with your deploy_directory and "gh-pages" with your deploy_branch.
1515

1616
1. `git --work-tree dist checkout --orphan gh-pages`
17-
- this will disconnect the gh-pages branch’s history from the current commit
18-
- in my app, the project root and dist had no files in common. If yours do, be careful if you don’t want to overwrite any existing files in dist
17+
- this will disconnect the gh-pages branch’s history from the current commit
18+
- in my app, the project root and dist had no files in common. If yours do, be careful if you don’t want to overwrite any existing files in dist
1919
2. `git --work-tree dist rm -r "*"`
20-
- remove the source files we just checked out; these aren’t the files we’re looking for
21-
- the quotes are required to prevent the shell from globbing in the current directory; we want git to glob in dist
20+
- remove the source files we just checked out; these aren’t the files we’re looking for
21+
- the quotes are required to prevent the shell from globbing in the current directory; we want git to glob in dist
2222
3. `git --work-tree dist add --all`
2323
4. `git --work-tree dist commit -m "initial publish"`
24+
5. `git push origin gh-pages`
25+
6. `git symbolic-ref HEAD refs/heads/master && git reset --mixed`
26+
- switch back to master branch
2427

2528
## run
2629
Do this every time you want to deploy, or have your CI server do it.

0 commit comments

Comments
 (0)