Skip to content

Commit 14f77f6

Browse files
committed
Update GitHub Actions
1 parent c19d964 commit 14f77f6

File tree

1 file changed

+45
-23
lines changed

1 file changed

+45
-23
lines changed

.github/workflows/tests.yml

Lines changed: 45 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,54 @@ concurrency:
1616
cancel-in-progress: false
1717

1818
jobs:
19-
tests:
19+
wiki:
20+
name: Update Wiki
2021
runs-on: ubuntu-latest
2122

22-
permissions:
23-
# Give the default GITHUB_TOKEN write permission to commit and push the
24-
# added or changed files to the repository.
25-
contents: write
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
submodules: recursive
28+
ref: ${{ github.head_ref || github.ref_name }}
29+
30+
- name: Install dependencies
31+
uses: php-actions/composer@v6
32+
env:
33+
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }'
34+
with:
35+
php_version: '8.4'
36+
37+
- name: Create Docs Markdown
38+
uses: phpDocumentor/[email protected]
39+
with:
40+
target: 'docs/wiki'
41+
template: 'vendor/saggre/phpdocumentor-markdown/themes/markdown'
2642

43+
- name: Commit submodule changes
44+
run: |
45+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
46+
git config --global user.name "github-actions[bot]"
47+
cd docs/wiki
48+
git add .
49+
if git diff --cached --quiet; then
50+
echo "No changes to commit in submodule"
51+
exit 0
52+
fi
53+
git commit -m "Update wiki content"
54+
git push origin HEAD:refs/heads/${{ github.head_ref || github.ref_name }}
55+
cd ../..
56+
git submodule update --remote --merge
57+
git add docs/wiki
58+
if git diff --cached --quiet; then
59+
echo "No submodule reference change to commit"
60+
exit 0
61+
fi
62+
git commit -m "Update wiki submodule reference [skip ci]"
63+
git push origin HEAD:refs/heads/${{ github.head_ref || github.ref_name }}
64+
tests:
65+
name: Run Tests and Deploy API Docs & Coverage
66+
runs-on: ubuntu-latest
2767
steps:
2868
- uses: actions/checkout@v4
2969
with:
@@ -80,24 +120,6 @@ jobs:
80120
target: 'public/'
81121
template: 'default'
82122

83-
- name: Update Wiki
84-
uses: phpDocumentor/[email protected]
85-
with:
86-
target: 'docs/wiki'
87-
template: 'vendor/saggre/phpdocumentor-markdown/themes/markdown'
88-
89-
- name: Commit submodule changes
90-
run: |
91-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
92-
git config --global user.name "github-actions[bot]"
93-
cd docs/wiki
94-
git add .
95-
git commit -m "Update wiki content [skip ci]" || echo "No changes to commit"
96-
git push origin HEAD:refs/heads/${{ github.head_ref || github.ref_name }}
97-
cd ../..
98-
git submodule update --remote --merge
99-
git push
100-
101123
- name: Upload artifact
102124
if: github.ref == 'refs/heads/main'
103125
uses: actions/upload-pages-artifact@v3

0 commit comments

Comments
 (0)