sp-dev-fx-webparts/.github/workflows/merge-sample-json.yml

43 lines
1.2 KiB
YAML

name: Merge Sample JSON
# on:
# push:
# branches:
# # When someone push to `main` branch
# - main
# # When someone pushes to `develop` branch
# - develop
# # When someone pushes to a branch within the `features` folder
# - 'features/**'
# Controls when the action will run. Workflow runs when manually triggered using the UI
# or API.
on:
workflow_dispatch
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
name: 'Merge all sample.json files to samples.json'
runs-on: ubuntu-latest
steps:
- name: Join samples
uses: actions/checkout@v2
with:
path: './'
- run: |
jq -s '[.[][]]' samples/**/assets/sample.json > samples.json
- name: Commit updated file
uses: EndBug/add-and-commit@v6
with:
message: 'Updated samples.json'
add: 'samples.json --force'
cwd: './'
token: ${{ secrets.TOKEN }}
- name: Copy to the pages
uses: planetoftheweb/copy-to-branches@v1
env:
key: main
branches: gh-pages
files: samples.json