14
14
# Allow running this workflow manually from the Actions tab.
15
15
workflow_dispatch :
16
16
# Allow this workflow to be triggered from outside.
17
+ repository_dispatch :
18
+ types :
19
+ - ' phpcs-release'
17
20
18
21
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
19
22
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
38
41
- name : Checkout code
39
42
uses : actions/checkout@v4
40
43
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 PHPCS version from setup-php.
53
+ - name : Retrieve latest release info
54
+
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
+ # ################################################################################
77
+ # Update Wiki files.
78
+ # ################################################################################
79
+
41
80
- name : Install DocToc table of contents generator
42
81
run : npm install -g doctoc
43
82
51
90
- name : Re-run tables of contents with different settings for specific file
52
91
run : doctoc ./_wiki/Version-4.0-User-Upgrade-Guide.md --github --maxlevel 3 --update-only
53
92
93
+
94
+ # ################################################################################
95
+ # Dry-run/PRs: upload artifact with pre-processed files and post comment in PR.
96
+ # ################################################################################
97
+
54
98
# Retention is normally 90 days, but this artifact is only to help with reviewing PRs,
55
99
# especially when new output blocks are added or the (workflow) code for existing ones
56
100
# is updated. All in all, no need to keep the artifact for more than a few days.
@@ -74,10 +118,15 @@ jobs:
74
118
A dry-run has been executed on your PR, executing all markdown pre-processing for the wiki files.
75
119
76
120
Please review the resulting final markdown files via the [created artifact](${{ steps.artifact.outputs.artifact-url }}).
77
- This is especially important when adding new pages.
121
+ This is especially important when adding new pages or updating auto-generated output blocks .
78
122
79
123
_N.B.: the above link will automatically be updated when this PR is updated._
80
124
125
+
126
+ # ################################################################################
127
+ # Deploy to the wiki in the PHPCS repo.
128
+ # ################################################################################
129
+
81
130
- name : Check GitHub Git Operations status
82
131
uses : crazy-max/ghaction-github-status@v4
83
132
with :
0 commit comments