Skip to content

Commit

Permalink
Update publish docs to use a community action (#614)
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
smyrick authored Feb 26, 2020
1 parent 8ff7de8 commit 0eaf573
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: [email protected]
Loading

0 comments on commit 0eaf573

Please sign in to comment.