Skip to content

Commit ee75fdf

Browse files
committed
WIP
1 parent 54b7ba6 commit ee75fdf

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

.github/workflows/publish-wiki.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,56 @@ jobs:
4141
- name: Checkout code
4242
uses: actions/checkout@v4
4343

44+
- name: Install PHP
45+
uses: shivammathur/setup-php@v2
46+
with:
47+
php-version: 'latest'
48+
ini-values: error_reporting=-1, display_errors=On, log_errors_max_len=0
49+
tools: phpcs, phpcbf
50+
coverage: none
51+
52+
# Make sure we've gotten the latest version from setup-php.
53+
- name: Retrieve latest release info
54+
uses: octokit/[email protected]
55+
id: get_latest_release
56+
with:
57+
route: GET /repos/PHPCSStandards/PHP_CodeSniffer/releases/latest
58+
env:
59+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60+
61+
- name: Grab latest tag name from API response
62+
id: latest_version
63+
run: |
64+
echo "TAG=${{ fromJson(steps.get_latest_release.outputs.data).tag_name }}" >> "$GITHUB_OUTPUT"
65+
66+
- name: Grab the version
67+
id: phar_version
68+
# yamllint disable-line rule:line-length
69+
run: echo "VERSION=$(phpcs --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+(\.[0-9]+)+')" >> "$GITHUB_OUTPUT"
70+
71+
- name: Fail the build if the PHAR is not the correct version
72+
if: ${{ steps.phar_version.outputs.VERSION != steps.latest_version.outputs.TAG }}
73+
run: exit 1
74+
75+
# ############################
76+
# Prepare output snippets.
77+
# ############################
78+
79+
- name: Create directory to place snippets in
80+
run: mkdir build/output-snippets
81+
82+
- name: "Usage page: phpcs help"
83+
run: phpcs --report-width=110 --no-colors -h > build/output-snippets/phpcs-h.txt
84+
85+
- name: "Fixing page: phpcbf help"
86+
run: phpbfs --report-width=110 --no-colors -h > build/output-snippets/phpcbf-h.txt
87+
88+
89+
90+
# ############################
91+
# Update Wiki files.
92+
# ############################
93+
4494
- name: Install DocToc table of contents generator
4595
run: npm install -g doctoc
4696

@@ -54,6 +104,11 @@ jobs:
54104
- name: Re-run tables of contents with different settings for specific file
55105
run: doctoc ./_wiki/Version-4.0-User-Upgrade-Guide.md --github --maxlevel 3 --update-only
56106

107+
108+
# ############################
109+
# Deploy.
110+
# ############################
111+
57112
# Retention is normally 90 days, but this artifact is only to help with reviewing PRs,
58113
# especially when new output blocks are added or the (workflow) code for existing ones
59114
# is updated. All in all, no need to keep the artifact for more than a few days.

0 commit comments

Comments
 (0)