Skip to content

Commit

Permalink
feat(CI): add a GitHub Action to lint the YAML (apache#111)
Browse files Browse the repository at this point in the history
- add a `.yamllint` config file
- lint some YAML
  • Loading branch information
jbampton authored Dec 17, 2020
1 parent da7f658 commit c80b6bc
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .asf.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
publish:
whoami: asf-site
whoami: asf-site
68 changes: 34 additions & 34 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ name: CI
# events but only for the master branch
on:
push:
branches: [ master ]
branches: [master]
schedule:
# Run everyday at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
- cron: "0 9 * * *"
# Run everyday at 9:00 AM (See https://pubs.opengroup.org/onlinepubs/9699919799/utilities/crontab.html#tag_20_25_07)
- cron: "0 9 * * *"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand All @@ -20,34 +20,34 @@ jobs:

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Clone apisix's docs from repo & update image's link
run: |
git clone https://github.com/apache/apisix.git
cp -r apisix/doc/images ./website/static && rm -rf apisix/doc/images
cp -r apisix/doc ./docs/apisix
- name: Build
run: cd website && yarn && yarn build

- name: Copy files
run: |
cd website/build/apisix-website
cp ../../../README.md ./ && cp ../../../.asf.yaml ./
cd apisix
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="\.\.\/\.\.\/doc\/images/src="https:\/\/apisix\.apache\.org\/images/g'
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="\.\.\/\.\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="\.\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="images/src="https:\/\/apisix\.apache\.org\/images/g'
- name: GitHub Pages
uses: crazy-max/[email protected]
with:
build_dir: website/build/apisix-website
target_branch: asf-site
keep_history: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2

- name: Clone apisix's docs from repo & update image's link
run: |
git clone https://github.com/apache/apisix.git
cp -r apisix/doc/images ./website/static && rm -rf apisix/doc/images
cp -r apisix/doc ./docs/apisix
- name: Build
run: cd website && yarn && yarn build

- name: Copy files
run: |
cd website/build/apisix-website
cp ../../../README.md ./ && cp ../../../.asf.yaml ./
cd apisix
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="\.\.\/\.\.\/doc\/images/src="https:\/\/apisix\.apache\.org\/images/g'
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="\.\.\/\.\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="\.\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="\.\/images/src="https:\/\/apisix\.apache\.org\/images/g'
find . -type f -name "*.html" -print0 | xargs -0 sed -i -e 's/src="images/src="https:\/\/apisix\.apache\.org\/images/g'
- name: GitHub Pages
uses: crazy-max/[email protected]
with:
build_dir: website/build/apisix-website
target_branch: asf-site
keep_history: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7 changes: 7 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,10 @@ jobs:
node-version: '12.x'
- run: npm install -g [email protected]
- run: markdownlint '**/*.md' --ignore node_modules
yamllint:
name: 🍏 YAML
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: 🧹 YAML Lint
uses: ibiqlik/action-yamllint@v3
8 changes: 8 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---

extends: default

rules:
document-start: false
line-length: false
truthy: false

0 comments on commit c80b6bc

Please sign in to comment.