add branch to action #263
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- "main" | |
- "lhci-action" | |
pull_request: | |
types: [opened, synchronize] | |
name: Build docs site artifact | |
jobs: | |
staging: | |
env: | |
s3_root_dir: gh-actions | |
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: 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 | |
PATH_PREFIX: /${{ env.s3_root_dir }}/${{ matrix.project }}/${{ github.sha }} | |
run: | | |
npm ci --legacy-peer-deps | |
npm run build | |
- 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: Publish build | |
uses: mongodb/docs-worker-actions/publish-build@main | |
env: | |
AWS_BUCKET: docs-mongodb-org-dotcomstg | |
SOURCE_DIR: public | |
DESTINATION_DIR: ${{ env.s3_root_dir }} | |
COMMIT_HASH: ${{ github.sha }} | |
PROJECT: ${{ matrix.project }} | |
GH_WORKSPACE: ${{ github.workspace }} | |
- name: Save Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifact-${{ matrix.project }} | |
path: | | |
public | |
- name: Run and Upload Lighthouse Report | |
uses: mongodb/docs-worker-actions/run-lighthouse@DOP-4249-lh-run | |
env: | |
LIGHTHOUSE_SERVER_URL: ${{ secrets.LIGHTHOUSE_SERVER_URL }} | |
LIGHTHOUSE_BUILD_TOKEN: ${{ secrets.LIGHTHOUSE_BUILD_TOKEN }} | |
LIGHTHOUSE_ADMIN_TOKEN: ${{ secrets.LIGHTHOUSE_ADMIN_TOKEN }} | |
STAGING_URL: https://www.mongodb.com/docs/atlas/ |