|
| 1 | +name: Update Readme |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths: |
| 8 | + - 'AutoGenerateParts/Readme*.md' |
| 9 | + - 'com.unity.toonshader/Documentation~/index.md' |
| 10 | + workflow_dispatch: |
| 11 | + |
| 12 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 13 | +jobs: |
| 14 | + # This workflow contains a single job called "build" |
| 15 | + update-readme: |
| 16 | + # The type of runner that the job will run on |
| 17 | + runs-on: ubuntu-latest |
| 18 | + |
| 19 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 20 | + steps: |
| 21 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 22 | + - uses: actions/checkout@v3 |
| 23 | + - name: Read header |
| 24 | + id: read-header |
| 25 | + uses: unity3d-jp/actions/read-file@main |
| 26 | + with: |
| 27 | + filepath: 'AutoGenerateParts/ReadmeHeader.md' |
| 28 | + - name: Read Documentation Index |
| 29 | + id: read-doc-index |
| 30 | + uses: unity3d-jp/actions/read-file@main |
| 31 | + with: |
| 32 | + filepath: 'com.unity.toonshader/Documentation~/index.md' |
| 33 | + - name: Overwrite Readme with Index |
| 34 | + id: overwrite-readme-with-index |
| 35 | + run: | |
| 36 | + cat <<"EOF" > README.md |
| 37 | + ${{ steps.read-doc-index.outputs.content }} |
| 38 | + EOF |
| 39 | + echo "$(<README.md )" |
| 40 | +
|
| 41 | + - name: Read footer |
| 42 | + id: read-footer |
| 43 | + uses: unity3d-jp/actions/read-file@main |
| 44 | + with: |
| 45 | + filepath: 'AutoGenerateParts/ReadmeFooter.md' |
| 46 | + - name: Update README file |
| 47 | + id: update-readme-file |
| 48 | + run: | |
| 49 | + mv README.md temp.md |
| 50 | + |
| 51 | + generated_file='README.md'; |
| 52 | + cat <<"EOF" > $generated_file |
| 53 | + ${{ steps.read-header.outputs.content }} |
| 54 | + EOF |
| 55 | + |
| 56 | + cat temp.md >> $generated_file |
| 57 | + rm temp.md |
| 58 | +
|
| 59 | + cat <<"EOF" >> $generated_file |
| 60 | + ${{ steps.read-footer.outputs.content }} |
| 61 | + EOF |
| 62 | + |
| 63 | + printf "\n\n\n" >> $generated_file |
| 64 | + echo -e "*Auto-generated on $(date)*" >> $generated_file |
| 65 | + - name: Append Documentation~ to local URLs |
| 66 | + id: append-url |
| 67 | + uses: unity3d-jp/actions/append-md-local-url@main |
| 68 | + with: |
| 69 | + filepath: 'README.md' |
| 70 | + prefix: 'Documentation~/' |
| 71 | + - name: git setting |
| 72 | + run: | |
| 73 | + git config --local user.email "github-actions[bot]@users.noreply.github.com" |
| 74 | + git config --local user.name "github-actions[bot]" |
| 75 | + - name: Commit files |
| 76 | + run: | |
| 77 | + git add . |
| 78 | + git commit -m "ga: update README (executed by update_readme.yml)" -m "[skip ci]" -a |
| 79 | + git pull |
| 80 | + git push -u |
| 81 | + |
0 commit comments