Release: 2024-12-17a #19452
Workflow file for this run
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
name: Deploy branch draft on Netlify | |
on: | |
pull_request: | |
types: [labeled, opened, synchronize] | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.head_ref }} | |
cancel-in-progress: true | |
jobs: | |
build-deploy: | |
if: | | |
( | |
(github.event.action == 'labeled' && github.event.label.name == 'deploy') || | |
(github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'deploy')) | |
) && !github.event.pull_request.head.repo.fork | |
runs-on: docs-16c-64gb-600gb | |
steps: | |
- name: inject slug/short variables | |
uses: rlespinasse/github-slug-action@v4 | |
- name: compose a name for the build environment | |
run: echo "BUILD_ENV_NAME=pr-${{ github.event.number }}-${{ env.GITHUB_HEAD_REF_SLUG }}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
fetch-depth: 0 # fetch whole repo so git-restore-mtime can work | |
lfs: true | |
- name: Adjust file watchers limit | |
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
cache: "npm" | |
cache-dependency-path: "package-lock.json" | |
env: | |
NODE_ENV: ${{ secrets.NODE_ENV }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Install dependencies | |
run: | | |
npm run presetup | |
npm ci --ignore-scripts | |
env: | |
NODE_ENV: ${{ secrets.NODE_ENV }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Run NPM install scripts | |
run: | | |
npm rebuild | |
- name: Checking Gatsby cache | |
id: gatsby-cache-build | |
uses: actions/cache@v4 | |
with: | |
path: | | |
public/* | |
!public/pdfs | |
.cache | |
key: ${{ runner.os }}-gatsby-build-draft-${{ github.head_ref }}-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-gatsby-build-draft-${{ github.head_ref }} | |
${{ runner.os }}-gatsby-build-develop-${{ hashFiles('package.json', 'gatsby-config.js', 'gatsby-node.js') }} | |
${{ runner.os }}-gatsby-build-develop | |
- name: Fix mtimes | |
run: npm run fix-mtimes | |
- name: Gatsby build | |
run: npm run build | |
env: | |
APP_ENV: staging | |
NODE_ENV: ${{ vars.NODE_ENV }} | |
NODE_OPTIONS: --max-old-space-size=4096 | |
FATHOM_SITE_ID: ${{ vars.FATHOM_SITE_ID }} | |
ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} | |
ALGOLIA_SEARCH_ONLY_KEY: ${{ vars.ALGOLIA_SEARCH_ONLY_KEY }} | |
ALGOLIA_APP_ID: ${{ vars.ALGOLIA_APP_ID }} | |
ALGOLIA_INDEX_NAME: edb-docs-staging | |
INDEX_ON_BUILD: false | |
- name: Deploy to Netlify | |
id: netlify-deploy | |
uses: nwtgck/actions-netlify@v3 | |
with: | |
publish-dir: "./public" | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
deploy-message: ${{ github.event.pull_request.title }} | |
enable-commit-comment: false | |
github-deployment-environment: ${{ env.BUILD_ENV_NAME }} | |
alias: deploy-preview-${{ github.event.number }} | |
env: | |
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} | |
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_DEVELOP_SITE_ID }} |