Skip to content

Commit

Permalink
Fix percy settings
Browse files Browse the repository at this point in the history
  • Loading branch information
falgon committed Jun 12, 2024
1 parent 6218795 commit ee7d7a6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
43 changes: 41 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ jobs:
build:
runs-on: ubuntu-20.04
if: github.repository == 'falgon/roki-web'
outputs:
node_version: ${{ steps.node_version.outputs.node_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -50,7 +52,11 @@ jobs:
node-version-file: '.nvmrc'
- name: Export node version value
id: node_version
run: echo "ROKI_WEB_GH_ACTIONS_NODE_VERSION=$(node --version)" >> "$GITHUB_ENV"
run: |
node_version="$(node --version)"
readonly node_version
echo "ROKI_WEB_GH_ACTIONS_NODE_VERSION=$node_version" >> "$GITHUB_ENV"
echo "node_version=$node_version" >> "$GITHUB_OUTPUT"
- name: Node module cache
uses: actions/cache@v4
id: node-cache
Expand Down Expand Up @@ -86,12 +92,45 @@ jobs:
xmllint docs/roki.log/feed/roki.log.xml --noout
xmllint docs/roki.diary/sitemap.xml --noout
xmllint docs/roki.diary/feed/roki.diary.xml --noout
tar cvf docs.tar.xz docs
- name: Upload artifact
if: github.ref == 'refs/heads/master'
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'
uses: actions/upload-artifact@v4
with:
name: roki.dev
path: docs.tar.xz
percy:
runs-on: ubuntu-latest
needs: build
if: github.ref == 'refs/heads/develop' || github.repository == 'falgon/roki-web'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '${{ needs.build.outputs.node_version }}'
- name: Node module cache
uses: actions/cache@v4
id: node-cache
with:
path: '**/node_modules'
key: node-v1-${{ needs.build.outputs.node_version }}-${{ runner.os }}-${{ hashFiles('.nvmrc') }}-${{ hashFiles('package.json') }}-${{ hashFiles('package-lock.json') }}
- name: Install Node dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Fetch archive
uses: actions/download-artifact@v4
with:
name: roki.dev
- name: Unarchive docs
run: tar xvf docs.tar.xz
- name: Apply percy
run: npx percy snapshot -q -t ${{ env.PERCY_TIMEOUT_MS }} ./docs
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_CLIENT_ERROR_LOGS: false
PERCY_TIMEOUT_MS: 750
deploy:
runs-on: ubuntu-latest
needs: build
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/build_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ jobs:
percy:
runs-on: ubuntu-latest
needs: build
if: github.repository == 'falgon/roki-web'
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down

0 comments on commit ee7d7a6

Please sign in to comment.