Changed folder structure
This commit is contained in:
parent
75e0f4f837
commit
ec13823125
|
@ -1,33 +1,29 @@
|
|||
name: Merge sample metadata
|
||||
name: Merge JSON
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 0 * * *"
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
# When someone push to `main` branch
|
||||
- main
|
||||
paths:
|
||||
- 'samples/**/assets/sample.json'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
name: 'Merge all sample.json files to samples.json'
|
||||
merge:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout main branch
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: main
|
||||
path: main
|
||||
|
||||
- name: Checkout gh-pages branch
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: gh-pages
|
||||
path: gh-pages
|
||||
|
||||
- name: Checkout Docs branch
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: Docs
|
||||
path: Docs
|
||||
|
@ -44,27 +40,33 @@ jobs:
|
|||
run: |
|
||||
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
|
||||
-H "Accept: application/vnd.github.v3.raw" \
|
||||
-o ./main/.metada/extension-samples.json \
|
||||
-o ./main/.metadata/extension-samples.json \
|
||||
https://raw.githubusercontent.com/pnp/sp-dev-fx-extensions/main/.metadata/samples.json
|
||||
|
||||
- name: Join samples
|
||||
run: |
|
||||
jq -s '[.[][]]' ./main/samples/**/assets/sample.json ./main/.metada/extension-samples.json > ./Docs/docs/samples.json
|
||||
jq -s '[.[][]]' ./main/samples/**/assets/sample.json ./main/.metadata/extension-samples.json > ./Docs/docs/samples.json
|
||||
|
||||
- name: copy file to gh-pages
|
||||
uses: canastro/copy-file-action@master
|
||||
with:
|
||||
source: "./Docs/docs/samples.json"
|
||||
target: "./gh-pages/samples.json"
|
||||
- name: Commit samples.json to gh-pages
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
cwd: ./gh-pages
|
||||
add: 'samples.json --force'
|
||||
push: true
|
||||
- name: Commit samples.json to Docs
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
cwd: ./Docs
|
||||
add: 'docs/samples.json --force'
|
||||
push: true
|
||||
- name: Copy samples.json to gh-pages branch
|
||||
run: cp ./Docs/docs/samples.json ./gh-pages/samples.json
|
||||
|
||||
- name: Commit samples.json to gh-pages branch
|
||||
run: |
|
||||
cd gh-pages
|
||||
git config --local user.email "${{ secrets.USER_EMAIL }}"
|
||||
git config --local user.name "${{ secrets.USER_NAME }}"
|
||||
git add samples.json
|
||||
git commit -m "Update samples.json in gh-pages branch"
|
||||
git push origin gh-pages
|
||||
|
||||
- name: Copy samples.json to Docs branch
|
||||
run: cp ./Docs/docs/samples.json ./Docs/docs/samples.json
|
||||
|
||||
- name: Commit samples.json to Docs branch
|
||||
run: |
|
||||
cd Docs
|
||||
git config --local user.email "${{ secrets.USER_EMAIL }}"
|
||||
git config --local user.name "${{ secrets.USER_NAME }}"
|
||||
git add docs/samples.json
|
||||
git commit -m "Update samples.json in Docs branch"
|
||||
git push origin Docs
|
Loading…
Reference in New Issue