2022-02-13 13:29:45 -05:00
|
|
|
name: Merge sample metadata
|
2022-02-12 15:48:05 -05:00
|
|
|
|
|
|
|
on:
|
2022-02-12 22:08:39 -05:00
|
|
|
push:
|
2022-02-12 22:05:46 -05:00
|
|
|
branches:
|
|
|
|
# When someone push to `main` branch
|
|
|
|
- main
|
|
|
|
paths:
|
|
|
|
- 'samples/**/assets/sample.json'
|
2022-02-12 15:48:05 -05:00
|
|
|
|
|
|
|
jobs:
|
2022-02-12 19:02:52 -05:00
|
|
|
build:
|
2022-02-12 19:42:39 -05:00
|
|
|
name: 'Merge all sample.json files to samples.json'
|
2022-02-12 19:02:52 -05:00
|
|
|
runs-on: ubuntu-latest
|
2022-02-12 15:48:05 -05:00
|
|
|
steps:
|
2022-02-13 03:08:28 -05:00
|
|
|
- name: Checkout main branch
|
2022-02-12 19:42:39 -05:00
|
|
|
uses: actions/checkout@v2
|
2022-02-13 03:08:28 -05:00
|
|
|
with:
|
|
|
|
ref: main
|
|
|
|
path: main
|
|
|
|
- name: Checkout gh-pages branch
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: gh-pages
|
|
|
|
path: gh-pages
|
2022-02-13 13:28:08 -05:00
|
|
|
- name: Checkout Docs branch
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
ref: Docs
|
|
|
|
path: Docs
|
2022-02-13 03:08:28 -05:00
|
|
|
- name: Join samples
|
|
|
|
run: |
|
2022-02-13 15:21:34 -05:00
|
|
|
jq -s '[.[][]]' ./main/samples/**/assets/sample.json > ./Docs/docs/samples.json
|
2022-02-12 20:34:18 -05:00
|
|
|
- name: Validate JSON
|
2022-02-12 20:33:06 -05:00
|
|
|
uses: docker://orrosenblatt/validate-json-action:latest
|
|
|
|
env:
|
2022-02-13 03:08:28 -05:00
|
|
|
INPUT_SCHEMA: ./main/metadata-schema.json
|
2022-02-13 15:21:34 -05:00
|
|
|
INPUT_JSONS: ./Docs/docs/samples.json
|
2022-02-13 13:28:08 -05:00
|
|
|
- name: copy file to gh-pages
|
2022-02-13 03:08:28 -05:00
|
|
|
uses: canastro/copy-file-action@master
|
|
|
|
with:
|
2022-02-13 15:21:34 -05:00
|
|
|
source: "./Docs/docs/samples.json"
|
2022-02-13 03:08:28 -05:00
|
|
|
target: "./gh-pages/samples.json"
|
|
|
|
- name: Commit samples.json to gh-pages
|
|
|
|
uses: EndBug/add-and-commit@v6
|
2022-02-12 20:15:57 -05:00
|
|
|
with:
|
2022-02-13 03:08:28 -05:00
|
|
|
cwd: ./gh-pages
|
|
|
|
branch: gh-pages
|
|
|
|
add: 'samples.json --force'
|
|
|
|
push: true
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
2022-02-13 13:28:08 -05:00
|
|
|
- name: Commit samples.json to Docs
|
|
|
|
uses: EndBug/add-and-commit@v6
|
|
|
|
with:
|
|
|
|
cwd: ./Docs
|
|
|
|
branch: Docs
|
|
|
|
add: 'docs/samples.json --force'
|
|
|
|
push: true
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|