Updated workflow

This commit is contained in:
Hugo Bernier 2022-02-13 03:08:28 -05:00 committed by GitHub
parent 9bb23453be
commit ea40b1a2ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 28 additions and 17 deletions

View File

@ -13,30 +13,41 @@ jobs:
name: 'Merge all sample.json files to samples.json' name: 'Merge all sample.json files to samples.json'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Join samples - name: Checkout main branch
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
path: './' ref: main
- run: | path: main
jq -s '[.[][]]' samples/**/assets/sample.json > samples.json - name: Checkout gh-pages branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
- name: Join samples
run: |
jq -s '[.[][]]' ./main/samples/**/assets/sample.json > ./main/samples.json
- name: Validate JSON - name: Validate JSON
uses: docker://orrosenblatt/validate-json-action:latest uses: docker://orrosenblatt/validate-json-action:latest
env: env:
INPUT_SCHEMA: /metadata-schema.json INPUT_SCHEMA: ./main/metadata-schema.json
INPUT_JSONS: /samples.json INPUT_JSONS: ./main/samples.json
- name: Commit updated file - name: copy file
uses: canastro/copy-file-action@master
with:
source: "./main/samples.json"
target: "./gh-pages/samples.json"
- name: Commit updated samples.json
uses: EndBug/add-and-commit@v6 uses: EndBug/add-and-commit@v6
with: with:
message: 'Updated samples.json' message: 'Updated samples.json'
add: 'samples.json --force' add: 'samples.json --force'
cwd: './' cwd: './main'
token: ${{ secrets.TOKEN }} token: ${{ secrets.TOKEN }}
- uses: actions/checkout@v2 - name: Commit samples.json to gh-pages
uses: EndBug/add-and-commit@v6
with: with:
fetch-depth: 0 cwd: ./gh-pages
- name: Copy to the pages branch: gh-pages
uses: planetoftheweb/copy-to-branches@v1 add: 'samples.json --force'
env: push: true
key: main token: ${{ secrets.GITHUB_TOKEN }}
branches: gh-pages
files: samples.json