diff --git a/.github/scripts/push-wai.js b/.github/scripts/push-wai.js new file mode 100644 index 0000000000..15803cbdb5 --- /dev/null +++ b/.github/scripts/push-wai.js @@ -0,0 +1,6 @@ +#!/usr/bin/env zx +import 'zx/globals' +import { config, commitAndPush } from './commons.mjs' + +const commitMessage = (await $`git log -1 --pretty=%B`).stdout +await commitAndPush(config, commitMessage) diff --git a/.github/scripts/wai-build.mjs b/.github/scripts/wai-build.mjs index 5c8b18f953..6b7b82dfaa 100644 --- a/.github/scripts/wai-build.mjs +++ b/.github/scripts/wai-build.mjs @@ -1,25 +1,35 @@ #!/usr/bin/env zx import 'zx/globals'; -import { config, cloneWcagActRules, commitAndPush } from './commons.mjs' +import { config, cloneWcagActRules } from './commons.mjs' + +const ACT_TOOLS_PATH = process.env.ACT_TOOLS_PATH || './node_modules/act-tools'; await cloneWcagActRules(config); await generateProposedRulePages(config); await generateexamples(config); -const commitMessage = (await $`git log -1 --pretty=%B`).stdout; -await commitAndPush(config, commitMessage); +await generateGlossaryPage(config); + +async function generateGlossaryPage({ tmpDir, rulesDir, glossaryDir, testAssetsDir }) { + await $`node ${ACT_TOOLS_PATH}/dist/cli/generate-glossary.js \ + --rulesDir "${rulesDir}" \ + --glossaryDir "${glossaryDir}" \ + --testAssetsDir "${testAssetsDir}" \ + --outDir "${tmpDir}" + `; +} async function generateProposedRulePages({ tmpDir, rulesDir, glossaryDir, testAssetsDir }) { - await $`node ./node_modules/act-tools/dist/cli/rule-transform.js \ - --rulesDir "${rulesDir}" \ - --glossaryDir "${glossaryDir}" \ - --testAssetsDir "${testAssetsDir}" \ - --outDir "${tmpDir}" \ - --proposed + await $`node ${ACT_TOOLS_PATH}/dist/cli/rule-transform.js \ + --rulesDir "${rulesDir}" \ + --glossaryDir "${glossaryDir}" \ + --testAssetsDir "${testAssetsDir}" \ + --outDir "${tmpDir}" \ + --proposed `; } async function generateexamples({ tmpDir, rulesDir, testAssetsDir }) { - await $`node ./node_modules/act-tools/dist/cli/build-examples.js \ + await $`node ${ACT_TOOLS_PATH}/dist/cli/build-examples.js \ --rulesDir "${rulesDir}" \ --testAssetsDir "${testAssetsDir}" \ --outDir "${tmpDir}" \ diff --git a/.github/workflows/wai-deploy.yml b/.github/workflows/wai-deploy.yml index 214457d272..b5b12c4b40 100644 --- a/.github/workflows/wai-deploy.yml +++ b/.github/workflows/wai-deploy.yml @@ -31,5 +31,7 @@ jobs: git config --global url."https://${{ secrets.WAI_GIT_NAME }}:${{ secrets.WAI_GIT_ACCESS_TOKEN }}@github.com".insteadOf "https://github.com" git config --global user.name "${{ secrets.WAI_GIT_NAME }}" git config --global user.email "${{ secrets.WAI_GIT_EMAIL }}" - - name: Build and deploy WAI update + - name: Build WAI update run: npm run build:wai + - name: Push WAI update + run: npm run push:wai diff --git a/package.json b/package.json index 5e37f27855..c9e7755a9d 100644 --- a/package.json +++ b/package.json @@ -178,6 +178,7 @@ "format": "prettier --write *.{json,md,js,html,css,yml} './{__tests__,_rules,.github,pages,test-assets,test-utils,utils}/**/*.{json,md,js,html,css,yml}'", "test": "jest --coverage", "build:wai": "zx .github/scripts/wai-build.mjs", + "push:wai": "zx .github/scripts/wai-push.mjs", "pr:preview": "zx .github/scripts/pr-preview.mjs" }, "homepage": "https://github.com/act-rules/act-rules.github.io",