Skip to content

Commit 7dd5e0e

Browse files
authored
build: update docs on Electron releases
1 parent 274f216 commit 7dd5e0e

File tree

1 file changed

+25
-10
lines changed

1 file changed

+25
-10
lines changed

.github/workflows/update-docs.yml

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,38 @@
11
name: 'Update docs'
22

33
on:
4-
repository_dispatch:
5-
types: [doc_changes]
64
workflow_dispatch:
75
inputs:
8-
sha:
6+
version:
97
type: string
10-
description: The SHA of the `electron/electron` commit
8+
description: The version of the latest Electron release
119
required: true
1210

1311
concurrency: update-docs
1412

1513
permissions: {}
1614

1715
jobs:
16+
get-latest-stable:
17+
runs-on: ubuntu-latest
18+
outputs:
19+
major: ${{ steps.latest-stable-major.outputs.major }}
20+
steps:
21+
- run: npm install @electron/fiddle-core
22+
- name: Get Latest Stable Major
23+
id: latest-stable-major
24+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
25+
with:
26+
script: |
27+
const { ElectronVersions } = await import('${{ github.workspace }}/node_modules/@electron/fiddle-core/dist/index.js');
28+
29+
const { latestStable } = await ElectronVersions.create(undefined, { ignoreCache: true });
30+
core.setOutput('major', latestStable.major);
1831
update-docs:
1932
runs-on: ubuntu-latest
2033
environment: docs-updater
34+
needs: get-latest-stable
35+
if: ${{ startsWith(github.event.inputs.version, format('v{0}', needs.get-latest-stable.outputs.major)) }}
2136
steps:
2237
- name: Generate GitHub App token
2338
uses: electron/github-app-auth-action@384fd19694fe7b6dcc9a684746c6976ad78228ae # v1.1.1
@@ -34,10 +49,10 @@ jobs:
3449
uses: bahmutov/npm-install@ec9e87262db2a1be2ca3ceb2d506c413a220542c # tag: v1.10.5
3550
- name: Prebuild
3651
run: |
37-
yarn pre-build ${{ github.event.client_payload.sha || github.event.inputs.sha }}
52+
yarn pre-build ${{ github.event.inputs.version }}
3853
git add .
39-
- name: Push changes
40-
uses: dsanders11/github-app-commit-action@43de6da2f4d927e997c0784c7a0b61bd19ad6aac # v1.5.0
41-
with:
42-
message: 'chore: update ref to docs (🤖)'
43-
token: ${{ steps.generate-token.outputs.token }}
54+
# - name: Push changes
55+
# uses: dsanders11/github-app-commit-action@43de6da2f4d927e997c0784c7a0b61bd19ad6aac # v1.5.0
56+
# with:
57+
# message: 'chore: update ref to docs (🤖)'
58+
# token: ${{ steps.generate-token.outputs.token }}

0 commit comments

Comments
 (0)