Skip to content

Commit de0e7a8

Browse files
authored
ci: autogenerate README.md (#515)
* add readme header/footer * add update-readme workflow
1 parent 5010a96 commit de0e7a8

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
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+

AutoGenerateParts/ReadmeFooter.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Post-Cloning Setup on Windows
2+
3+
This repository utilizes symbolic links to share code across multiple projects.
4+
On Windows 10 or later, symbolic link creation is restricted by default for regular users,
5+
which can lead to issues when working with this repository.
6+
7+
To resolve this, follow the steps below to enable symbolic link creation and configure Git appropriately.
8+
9+
1. Open **Local Security Policy** by typing `secpol.msc` on Windows Command Prompt
10+
11+
![](Images/CreateSymbolicLinks_LocalSecurityPolicy.jpg)
12+
13+
14+
2. Under **User Rights Assignment**, find a policy called **Create symbolic links** and open it.
15+
- Click **Add User or Group**
16+
- Click **Object Types**
17+
- Make sure **Groups** is checked and click **OK**.
18+
19+
![](Images/CreateSymbolicLinks_Properties.jpg)
20+
21+
3. Type **USERS** inside the textbox and click on **Check Names** to verify it, then click **OK**.
22+
23+
![](Images/CreateSymbolicLinks_SelectUsers.jpg)
24+
25+
4. Configure git to allow symbolic links. For example, by typing the following in Git Bash:
26+
27+
```
28+
git config --local core.symlinks true
29+
git config --global core.symlinks true
30+
```
31+

AutoGenerateParts/ReadmeHeader.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Latest official docs
2+
- [English](https://docs.unity3d.com/Packages/com.unity.toonshader@latest)
3+
- [日本語](https://docs.unity3d.com/ja/Packages/com.unity.toonshader@latest)
4+

0 commit comments

Comments
 (0)