Skip to content

DOP-4991: Dark Mode Guide Cue (announcement) (#1232) #732

DOP-4991: Dark Mode Guide Cue (announcement) (#1232)

DOP-4991: Dark Mode Guide Cue (announcement) (#1232) #732

Workflow file for this run

on:
push:
branches:
- "main"
pull_request:
types: ["opened", "synchronize"]
# REVERT BEFORE MERGE
branches:
- main
- "DOP-4616"
name: Run and Upload Lighthouse Reports
jobs:
staging:
permissions: write-all
runs-on: ubuntu-latest
strategy:
matrix:
project: ['cloud-docs', 'docs']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '18.x'
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Access Build Data
uses: mongodb/docs-worker-actions/build-artifact@main
env:
PROJECT_TO_BUILD: ${{ matrix.project }}
- name: Build Snooty
env:
NPM_BASE_64_AUTH: ${{ secrets.NPM_BASE_64_AUTH }}
NPM_EMAIL: ${{ secrets.NPM_EMAIL }}
GATSBY_BUILD_FROM_JSON: true
GATSBY_PARSER_USER: docsworker-xlarge
GATSBY_SITE: ${{ matrix.project }}
GATSBY_PARSER_BRANCH: main
run: |
npm ci --legacy-peer-deps
npm run build
- name: Run Lighthouse
env:
GATSBY_SITE: ${{ matrix.project }}
run: |
npm install -g @lhci/cli
lhci collect --additive --config=.mobile-lighthouserc.js
lhci collect --additive --config=.desktop-lighthouserc.js
lhci upload --target=filesystem --outputDir=./lhci
- name: Output commit timestamp
id: commit_timestamp_step
run: |
TIMESTAMP=$(git log -1 --format=%cd --date=iso-strict)
echo "COMMIT_TIMESTAMP=${TIMESTAMP}" >> $GITHUB_ENV
- name: Output commit message on the pull request
id: commit_message_step
run: |
if ${{ github.ref != 'refs/heads/main' }} == true; then
response=$(curl --request GET --url 'https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/commits?page=1&per_page=1000' --header 'Accept: application/vnd.github.v3+json' --header 'Content-Type: application/json')
last_commit_message=$(echo "$response" | jq '.[-1].commit.message')
echo "COMMIT_MESSAGE=$last_commit_message"
COMMIT_MESSAGE=$last_commit_message
echo "COMMIT_MESSAGE=${COMMIT_MESSAGE}" >> $GITHUB_ENV
else
FULL_MESSAGE="${{ github.event.head_commit.message }}"
FIRST_LINE=$(echo "$FULL_MESSAGE" | head -n 1)
echo "COMMIT_MESSAGE=${FIRST_LINE}" >> $GITHUB_ENV
fi
- name: Upload Lighthouse to Atlas and S3
uses: mongodb/docs-worker-actions/upload-lighthouse@main
env:
PROJECT_TO_BUILD: ${{ matrix.project }}
COMMIT_MESSAGE: ${{ env.COMMIT_MESSAGE }}
COMMIT_TIMESTAMP: ${{ env.COMMIT_TIMESTAMP }}
BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
ATLAS_URI: ${{ secrets.ATLAS_URI }}