Skip to content

Commit 650a409

Browse files
committed
Update GitHub Actions
1 parent 86b6d32 commit 650a409

File tree

2 files changed

+69
-80
lines changed

2 files changed

+69
-80
lines changed

.github/workflows/tests.yml

Lines changed: 3 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -16,83 +16,6 @@ concurrency:
1616
cancel-in-progress: false
1717

1818
jobs:
19-
wiki:
20-
name: Update Wiki
21-
runs-on: ubuntu-latest
22-
steps:
23-
- name: Checkout repository
24-
uses: actions/checkout@v4
25-
with:
26-
submodules: recursive
27-
ref: ${{ github.head_ref || github.ref_name }}
28-
29-
- name: Get Composer Cache Directory
30-
id: composer-cache
31-
run: |
32-
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
33-
34-
- name: Cache Composer dependencies
35-
uses: actions/cache@v4
36-
with:
37-
path: ${{ steps.composer-cache.outputs.dir }}
38-
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
39-
restore-keys: |
40-
${{ runner.os }}-composer-
41-
42-
- name: Install dependencies
43-
uses: php-actions/composer@v6
44-
env:
45-
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }'
46-
with:
47-
php_version: '8.4'
48-
49-
- name: Create Docs Markdown
50-
uses: php-actions/composer@v6
51-
with:
52-
php_version: '8.4'
53-
command: 'docs'
54-
55-
- name: Commit submodule changes
56-
run: |
57-
git config --global user.email "github-actions[bot]@users.noreply.github.com"
58-
git config --global user.name "github-actions[bot]"
59-
60-
cd docs/wiki
61-
git remote set-url origin https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.wiki.git
62-
63-
git fetch origin
64-
BRANCH_NAME="${{ github.head_ref || github.ref_name }}"
65-
66-
if [ "$BRANCH_NAME" = "main" ]; then
67-
if ! git ls-remote --exit-code --heads origin main > /dev/null; then
68-
BRANCH_NAME="master"
69-
fi
70-
fi
71-
72-
git checkout -b temp-branch origin/$BRANCH_NAME
73-
git pull origin $BRANCH_NAME --rebase
74-
75-
git add .
76-
if git diff --cached --quiet; then
77-
echo "No changes to commit in submodule"
78-
exit 0
79-
fi
80-
81-
git commit -m "Update wiki content"
82-
git push origin HEAD:refs/heads/$BRANCH_NAME
83-
84-
cd ../..
85-
86-
git submodule update --remote --merge
87-
88-
git add docs/wiki
89-
if git diff --cached --quiet; then
90-
echo "No submodule reference change to commit"
91-
exit 0
92-
fi
93-
94-
git commit -m "Update wiki submodule reference [skip ci]"
95-
git push origin HEAD:refs/heads/${{ github.head_ref || github.ref_name }}
9619
tests:
9720
name: Run Tests
9821
runs-on: ubuntu-latest
@@ -146,11 +69,11 @@ jobs:
14669
exit 1
14770
fi
14871
149-
- name: Generate API docs
72+
- name: Generate phpDocumentor API Docs
15073
uses: php-actions/composer@v6
15174
with:
15275
php_version: '8.4'
153-
command: 'docs -- --target=public/ --template="default"'
76+
command: 'docs -- --target=public/ --template=""'
15477

15578
- name: Upload artifact
15679
if: github.ref == 'refs/heads/main'
@@ -159,7 +82,7 @@ jobs:
15982
path: public/
16083

16184
deploy:
162-
name: Deploy API Docs & Coverage to GitHub Pages
85+
name: Deploy to GitHub Pages
16386
if: github.ref == 'refs/heads/main'
16487
needs: tests
16588
environment:

.github/workflows/wiki.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Update Wiki
2+
on:
3+
workflow_dispatch:
4+
pull_request:
5+
push:
6+
branches: [ "main" ]
7+
8+
permissions:
9+
contents: write
10+
id-token: write
11+
12+
jobs:
13+
wiki:
14+
name: Update Wiki
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout repository
18+
uses: actions/checkout@v4
19+
with:
20+
token: '${{ github.token }}'
21+
submodules: recursive
22+
23+
- name: Get Composer Cache Directory
24+
id: composer-cache
25+
run: |
26+
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
27+
28+
- name: Cache Composer dependencies
29+
uses: actions/cache@v4
30+
with:
31+
path: ${{ steps.composer-cache.outputs.dir }}
32+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
33+
restore-keys: |
34+
${{ runner.os }}-composer-
35+
36+
- name: Install dependencies
37+
uses: php-actions/composer@v6
38+
env:
39+
COMPOSER_AUTH: '{"github-oauth": {"github.com": "${{ github.token }}"} }'
40+
with:
41+
php_version: '8.4'
42+
43+
- name: Create Docs Markdown
44+
uses: php-actions/composer@v6
45+
with:
46+
php_version: '8.4'
47+
command: 'docs'
48+
49+
- name: Git Submodule Update
50+
run: |
51+
git pull --recurse-submodules
52+
git submodule update --remote --recursive
53+
54+
- name: Commit update
55+
run: |
56+
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
57+
58+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
59+
git config --global user.name "github-actions[bot]"
60+
61+
cd docs/wiki
62+
git remote set-url origin https://x-access-token:${{ github.token }}@github.com/${{ github.repository }}.wiki.git
63+
64+
git add --all
65+
git commit -m "Update submodules" || echo "No changes to commit"
66+
git push

0 commit comments

Comments
 (0)