Skip to content

Commit 0eaf573

Browse files
authored
Update publish docs to use a community action (#614)
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
1 parent 8ff7de8 commit 0eaf573

File tree

5 files changed

+991
-849
lines changed

5 files changed

+991
-849
lines changed

.github/workflows/pr-check-docs.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
check-docs:
1313

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

1617
steps:
1718
- uses: actions/checkout@v2
@@ -21,8 +22,14 @@ jobs:
2122
with:
2223
node-version: 12
2324

24-
- name: Run npm commands
25-
if: github.repository == 'ExpediaGroup/graphql-kotlin'
25+
- uses: actions/cache@v1
26+
with:
27+
path: ~/.npm
28+
key: ${{ runner.os }}-node-${{ hashFiles('website/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-node-
31+
32+
- name: Build website
2633
run: |
2734
cd website
2835
npm install

.github/workflows/publish-docs.yml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
publish-docs:
1313

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

1617
steps:
1718
- uses: actions/checkout@v2
@@ -21,18 +22,23 @@ jobs:
2122
with:
2223
node-version: 12
2324

24-
- name: Run npm commands
25-
if: github.repository == 'ExpediaGroup/graphql-kotlin'
25+
- uses: actions/cache@v1
26+
with:
27+
path: ~/.npm
28+
key: ${{ runner.os }}-node-${{ hashFiles('website/package-lock.json') }}
29+
restore-keys: |
30+
${{ runner.os }}-node-
31+
32+
- name: Build website
2633
run: |
2734
cd website
2835
npm install
29-
git config --global user.name "${GH_USERNAME}"
30-
echo "machine github.com login ${GH_USERNAME} password ${{ secrets.EG_CI_USER_TOKEN }}" > ~/.netrc
31-
GIT_USER="${GH_USERNAME}" npm run publish-gh-pages
32-
env:
33-
CI: true
34-
CURRENT_BRANCH: master
35-
36-
# The following settings will only work with the personal access token we are using
37-
# Until GH Actions have a way to publish directly we are using this method
38-
GH_USERNAME: eg-oss-ci
36+
npm run build
37+
38+
- name: Deploy GitHub Pages
39+
uses: peaceiris/actions-gh-pages@v3
40+
with:
41+
github_token: ${{ secrets.GITHUB_TOKEN }}
42+
publish_dir: ./build
43+
user_name: eg-oss-ci
44+
user_email: [email protected]

0 commit comments

Comments
 (0)