Skip to content

Commit

Permalink
chore(docs): Add workflow to publish generated docs to .org site
Browse files Browse the repository at this point in the history
  • Loading branch information
isner committed Jun 6, 2024
1 parent b7ccad7 commit 1e051bd
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 8 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/publish-generated-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Publish generated docs

on:
push:
branches:
- generated-docs # TODO: switch to develop

env:
BRANCH_NAME: publish-generated-docs

jobs:
generate_docs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Generate docs files
run: |
npm ci
npm run build -- --all-lang
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: generated-docs
path: tmp/doc

push_to_axe_site_repo:
needs: generate_docs
runs-on: ubuntu-latest
steps:
- name: Checkout axe site repository
uses: actions/checkout@v4
with:
repository: ${{ secrets.AXE_SITE_REPO }}
token: ${{ secrets.AXE_SITE_REPO_TOKEN }}
fetch-depth: 0

- name: Download artifact
uses: actions/download-artifact@v4
with:
name: generated-docs
path: ../generated-docs

- name: Copy docs files to target branch
run: |
git status
git config user.name github-actions
git config user.email [email protected]
git checkout $BRANCH_NAME || git checkout -b $BRANCH_NAME
cp -r ../generated-docs/* src/pages/docs/markdown/
- name: Check for changes
id: changes
run: |
changes=$(git status --porcelain)
# see https://unix.stackexchange.com/a/509498
echo $changes | grep . && echo "Changes detected" || echo "No changes"
echo "changes=$changes" >> "$GITHUB_OUTPUT"
- name: Push branch to axe site repository
if: steps.changes.outputs.changes != ''
run: |
git add .
git commit -m "chore(docs): publish generated docs"
git push origin $BRANCH_NAME
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,3 @@ doc/api/*

# ts generated file
typings/axe-core/axe-core-tests.js

# doc
doc/rule-descriptions.*.md

4 changes: 2 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ module.exports = function (grunt) {
'aria-supported': {
data: {
entry: 'lib/commons/aria/index.js',
destFile: 'doc/aria-supported.md',
destFile: 'tmp/doc/aria-supported.md',
options: {
langs: langs
},
Expand All @@ -147,7 +147,7 @@ module.exports = function (grunt) {
src: [''],
dest: {
auto: 'tmp/rules' + lang + '.js',
descriptions: 'doc/rule-descriptions' + lang + '.md'
descriptions: 'tmp/doc/rule-descriptions' + lang + '.md'
}
};
})
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
],
"standard-version": {
"scripts": {
"postbump": "npm ci && npm run sri-update && git add doc/rule-descriptions.md"
"postbump": "npm ci && npm run sri-update"
},
"skip": {
"tag": true
Expand Down Expand Up @@ -113,7 +113,7 @@
"prepare": "husky",
"prebuild": "node ./build/check-node-version.js",
"pretest": "node ./build/check-node-version.js",
"postbuild": "prettier --write ./locales/_template.json ./doc/rule-descriptions.md"
"postbuild": "prettier --write ./locales/_template.json"
},
"devDependencies": {
"@axe-core/webdriverjs": "^4.9.0",
Expand Down

0 comments on commit 1e051bd

Please sign in to comment.