Skip to content

Commit

Permalink
Added custom github domain support (#84)
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Fritzler <[email protected]>
  • Loading branch information
afritzler committed Mar 5, 2021
1 parent 15816bb commit 8d96386
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ It is more **secure** than a personal token, since you never actually see the va

Note that for this approach, Github Pages will be enabled in Settings but you will _not_ have a URL displayed or environment tab yet. So change the Github Pages settings to another target and then back again to `gh-pages` (if that is your branch to serve) - then you will see a URL. This step is only needed on the _first_ deploy and no action is needed later on.

### Alternative GITHUB_DOMAIN

In case this action should be used in a Github Enterprise environment you can overwrite the `github.com` domain with your corresponding Github Enterprise domain name by specifying the `GITHUB_DOMAIN` environment variable.

### Custom domain for github pages

MkDocs can be deployed to github pages using a custom domain, if you populate a `CUSTOM_DOMAIN` environment variable. This will generate a CNAME file, which will be placed inside the `/docs` folder.
Expand Down Expand Up @@ -61,4 +65,5 @@ jobs:
CUSTOM_DOMAIN: optionaldomain.com
CONFIG_FILE: folder/mkdocs.yml
EXTRA_PACKAGES: build-base
# GITHUB_DOMAIN: github.myenterprise.com
```
6 changes: 3 additions & 3 deletions action.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,18 @@ fi

if [ -n "${GITHUB_TOKEN}" ]; then
print_info "setup with GITHUB_TOKEN"
remote_repo="https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
remote_repo="https://x-access-token:${GITHUB_TOKEN}@${GITHUB_DOMAIN:-github.com}/${GITHUB_REPOSITORY}.git"
elif [ -n "${PERSONAL_TOKEN}" ]; then
print_info "setup with PERSONAL_TOKEN"
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
remote_repo="https://x-access-token:${PERSONAL_TOKEN}@${GITHUB_DOMAIN:-github.com}/${GITHUB_REPOSITORY}.git"
fi

if ! git config --get user.name; then
git config --global user.name "${GITHUB_ACTOR}"
fi

if ! git config --get user.email; then
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.${GITHUB_DOMAIN:-github.com}"
fi

git remote rm origin
Expand Down

0 comments on commit 8d96386

Please sign in to comment.