Skip to content

Commit

Permalink
website workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
epoberezkin committed Dec 15, 2020
1 parent 12690ac commit 736e680
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 25 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,10 @@ jobs:
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: update website
if: ${{ matrix.node-version == '14.x' }}
run: ./scripts/publish-bundles
env:
GH_TOKEN_PUBLIC: ${{ secrets.GH_TOKEN_PUBLIC }}
GIT_USER_EMAIL: ${{ secrets.GIT_USER_EMAIL }}
GIT_USER_NAME: ${{ secrets.GIT_USER_NAME }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The fastest JSON Schema validator for Node.js and browser. Supports draft-06/07/

## Platinum sponsors

[<img src="https://www.poberezkin.com/images/mozilla.svg" width="45%">](https://www.mozilla.org)[<img src="./.github/img/gap.svg" width="9%">](https://opencollective.com/ajv)[<img src="./.github/img/reserved.svg" width="45%">](https://opencollective.com/ajv)
[<img src="https://www.poberezkin.com/images/mozilla.svg" width="45%">](https://www.mozilla.org)[<img src="https://ajv.js.org/images/gap.svg" width="9%">](https://opencollective.com/ajv)[<img src="https://ajv.js.org/images/reserved.svg" width="45%">](https://opencollective.com/ajv)

## Using version 7

Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
"cross-env": "^7.0.2",
"eslint": "^7.8.1",
"eslint-config-prettier": "^7.0.0",
"gh-pages-generator": "^0.2.3",
"glob": "^7.0.0",
"husky": "^4.2.5",
"if-node-version": "^1.0.0",
Expand Down
30 changes: 30 additions & 0 deletions scripts/publish-gh-pages
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env bash

set -e

echo "About to publish $GITHUB_REF to gh-pages..."

rm -rf ../gh-pages

git config --global user.name "$GIT_USER_NAME"
git config --global user.email "$GIT_USER_EMAIL"
git clone -b gh-pages --single-branch https://${GH_TOKEN_PUBLIC}@github.com/ajv-validator/ajv.git ../gh-pages
SOURCE=../gh-pages/_source
mkdir -p $SOURCE
cp *.md $SOURCE
cp -R docs $SOURCE
cp LICENSE $SOURCE
cd ../gh-pages
node ./generate

# remove logo from README
sed -E "s/<img[^>]+ajv_logo[^>]+>//" index.md > new-index.md
mv new-index.md index.md

if [[ `git status --porcelain` ]]; then
echo "Changes detected. Updating gh-pages branch..."
git commit -am "updated by ajv workflow https://github.com/ajv-validator/ajv/actions/runs/$GITHUB_RUN_ID"
git push --quiet origin gh-pages > /dev/null 2>&1
fi

echo "Done"
23 changes: 0 additions & 23 deletions scripts/travis-gh-pages

This file was deleted.

0 comments on commit 736e680

Please sign in to comment.