Skip to content

Commit

Permalink
Update publish docs to use a community action
Browse files Browse the repository at this point in the history
Use https://github.com/peaceiris/actions-gh-pages to publish to the gh-pages branch. This will hopefully remove some config and tokens that we need to save now that GH Actions support pushing branch via the GITHUB_TOKEN secret

See: peaceiris/actions-gh-pages#9
  • Loading branch information
Shane Myrick committed Feb 25, 2020
1 parent 8ff7de8 commit aa5d901
Show file tree
Hide file tree
Showing 5 changed files with 991 additions and 849 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/pr-check-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
check-docs:

runs-on: ubuntu-latest
if: github.repository == 'ExpediaGroup/graphql-kotlin'

steps:
- uses: actions/checkout@v2
Expand All @@ -21,8 +22,14 @@ jobs:
with:
node-version: 12

- name: Run npm commands
if: github.repository == 'ExpediaGroup/graphql-kotlin'
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('website/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build website
run: |
cd website
npm install
Expand Down
30 changes: 18 additions & 12 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
publish-docs:

runs-on: ubuntu-latest
if: github.repository == 'ExpediaGroup/graphql-kotlin'

steps:
- uses: actions/checkout@v2
Expand All @@ -21,18 +22,23 @@ jobs:
with:
node-version: 12

- name: Run npm commands
if: github.repository == 'ExpediaGroup/graphql-kotlin'
- uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('website/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build website
run: |
cd website
npm install
git config --global user.name "${GH_USERNAME}"
echo "machine github.com login ${GH_USERNAME} password ${{ secrets.EG_CI_USER_TOKEN }}" > ~/.netrc
GIT_USER="${GH_USERNAME}" npm run publish-gh-pages
env:
CI: true
CURRENT_BRANCH: master

# The following settings will only work with the personal access token we are using
# Until GH Actions have a way to publish directly we are using this method
GH_USERNAME: eg-oss-ci
npm run build
- name: Deploy GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build
user_name: eg-oss-ci
user_email: oss@expediagroup.com
Loading

0 comments on commit aa5d901

Please sign in to comment.