Skip to content

Commit

Permalink
ci: add pull request workflow documentation build commit status check (
Browse files Browse the repository at this point in the history
  • Loading branch information
rostislav-simonik authored Dec 19, 2022
1 parent f3923e2 commit 4522e1d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 24 deletions.
30 changes: 6 additions & 24 deletions .github/workflows/nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,29 +30,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Detect package manager
id: detect-package-manager
working-directory: ./docs
run: |
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "::set-output name=manager::yarn"
echo "::set-output name=command::install"
echo "::set-output name=runner::yarn"
exit 0
elif [ -f "${{ github.workspace }}/package.json" ]; then
echo "::set-output name=manager::npm"
echo "::set-output name=command::ci"
echo "::set-output name=runner::npx --no-install"
exit 0
else
echo "Unable to determine packager manager"
exit 1
fi
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
cache: ${{ steps.detect-package-manager.outputs.manager }}
cache: 'yarn'
- name: Setup Pages
uses: actions/configure-pages@v2
with:
Expand All @@ -67,19 +49,19 @@ jobs:
path: |
docs/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/docs/package-lock.json', '**/docs/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/docs/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/docs/package-lock.json', '**/docs/yarn.lock') }}-
${{ runner.os }}-nextjs-${{ hashFiles('**/docs/yarn.lock') }}-
- name: Install dependencies
working-directory: ./docs
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
run: yarn install
- name: Build with Next.js
working-directory: ./docs
run: ${{ steps.detect-package-manager.outputs.runner }} next build
run: yarn next build
- name: Static HTML export with Next.js
working-directory: ./docs
run: ${{ steps.detect-package-manager.outputs.runner }} next export
run: yarn next export
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,3 +185,44 @@ jobs:
run: yarn -s test:ci
env:
DATABASE: ${{ matrix.database }}

test-documentation-build:
needs: [validate]
name: Test documentation build

runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Setup Pages
uses: actions/configure-pages@v2
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next
- name: Restore cache
uses: actions/cache@v3
with:
path: |
docs/.next/cache
# Generate a new cache whenever packages or source files change.
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/docs/yarn.lock') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
# If source files changed but packages didn't, rebuild from a prior cache.
restore-keys: |
${{ runner.os }}-nextjs-${{ hashFiles('**/docs/yarn.lock') }}-
- name: Install dependencies
working-directory: ./docs
run: yarn install
- name: Build with Next.js
working-directory: ./docs
run: yarn next build
- name: Static HTML export with Next.js
working-directory: ./docs
run: yarn next export

0 comments on commit 4522e1d

Please sign in to comment.