build: add docs-only path gating to GHA (#42499)

* build: add docs only workflow

* build: add path filtering action

* build: add actions/checkout

* build: explicitly set shell to bash -_-

* build: why regex when you could do something much dumber

* build: correct conditionals

* test: (do not merge) add base for testing

* test: remove git base (used for testing)
This commit is contained in:
Keeley Hammond 2024-06-14 11:08:41 -05:00 committed by GitHub
parent 5397560ab3
commit 5b98be3ccb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 74 additions and 2 deletions

View file

@ -27,6 +27,24 @@ on:
# pull_request:
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
docs: ${{ steps.filter.outputs.docs }}
src: ${{ steps.filter.outputs.src }}
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 #v4.0.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
docs:
- 'docs/**'
src:
- '!docs/**'
# Lint Jobs
lint:
if: ${{ !inputs.skip-lint }}
@ -35,9 +53,19 @@ jobs:
container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root"}'
secrets: inherit
# Docs Only Jobs
docs-only:
needs: changes
if: ${{ needs.changes.outputs.docs == 'true' && needs.changes.outputs.src == 'false'}}
uses: ./.github/workflows/pipeline-electron-docs-only.yml
with:
container: '{"image":"ghcr.io/electron/build:${{ inputs.build-image-sha }}","options":"--user root"}'
secrets: inherit
# Checkout Jobs
checkout-macos:
if: ${{ !inputs.skip-macos }}
needs: changes
if: ${{ needs.changes.outputs.src == 'true' && !inputs.skip-macos}}
runs-on: aks-linux-large
container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}
@ -59,7 +87,8 @@ jobs:
generate-sas-token: 'true'
checkout-linux:
if: ${{ !inputs.skip-linux }}
needs: changes
if: ${{ needs.changes.outputs.src == 'true' && !inputs.skip-linux}}
runs-on: aks-linux-large
container:
image: ghcr.io/electron/build:${{ inputs.build-image-sha }}

View file

@ -0,0 +1,43 @@
name: Electron Docs Compile
on:
workflow_call:
inputs:
container:
required: true
description: 'Container to run the docs-only ts compile in'
type: string
concurrency:
group: electron-docs-only-${{ github.ref }}
cancel-in-progress: true
jobs:
docs-only:
name: Docs Only Compile
runs-on: aks-linux-medium
timeout-minutes: 20
container: ${{ fromJSON(inputs.container) }}
steps:
- name: Checkout Electron
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29
with:
path: src/electron
fetch-depth: 0
- name: Install Dependencies
run: |
cd src/electron
node script/yarn install
- name: Run TS/JS compile
shell: bash
run: |
cd src/electron
node script/yarn create-typescript-definitions
node script/yarn tsc -p tsconfig.default_app.json --noEmit
for f in build/webpack/*.js
do
out="${f:29}"
if [ "$out" != "base.js" ]; then
node script/yarn webpack --config $f --output-filename=$out --output-path=./.tmp --env mode=development
fi
done