-
-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (98 loc) · 3.75 KB
/
Copy pathupdate-website.yml
File metadata and controls
119 lines (98 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Deploy static content to GH Pages
on:
# Runs on pushes targeting the default branch
push:
branches:
- 'stable'
# Do a dry-run (update, no deploy) for PRs.
pull_request:
# Allow running this workflow manually from the Actions tab.
workflow_dispatch:
# Allow this workflow to be triggered from outside.
repository_dispatch:
types:
- 'phpcs-release'
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: write
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
update:
# Don't run on forks.
if: github.repository == 'PHPCSStandards/schema.phpcodesniffer.com'
name: "Update XSD files"
runs-on: ubuntu-latest
steps:
# By default use the `stable` branch.
# For testing changes to the workflow or the scripts, use the PR branch
# to have access to the latest version of the workflow/scripts.
- name: Determine branch to use
id: base_branch
env:
REF: ${{ github.ref }}
run: |
if [ "${{ github.event_name }}" == "pull_request" ]; then
echo "BRANCH=$REF" >> "$GITHUB_OUTPUT"
else
echo 'BRANCH=stable' >> "$GITHUB_OUTPUT"
fi
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ steps.base_branch.outputs.BRANCH }}
- name: Install PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: '8.4'
ini-values: error_reporting=-1, display_errors=On, display_startup_errors=On, log_errors_max_len=0
coverage: none
env:
fail-fast: true
- name: Get a list of the last 50 PHP_CodeSniffer releases
env:
GH_TOKEN: ${{ github.token }}
run: >
gh release list --repo PHPCSStandards/PHP_CodeSniffer --limit=50 --order desc
--json tagName,isPrerelease,isLatest,isDraft > releases.json
- name: Update XSD files
run: php ./src/update-site.php
- name: Delete releases.json
run: rm releases.json
- name: "Debug info: check git status"
run: git status -b -v -u
# Commit all changed files back to the repository
- name: Commit updated files
uses: stefanzweifel/git-auto-commit-action@778341af668090896ca464160c2def5d1d1a3eb0 # v6.0.1
with:
commit_message: "Update XSD files"
add_options: '-A'
- name: Check GitHub Pages status
uses: crazy-max/ghaction-github-status@f0ef9e1cf727f9f76f8485f8c525fa03afc4ec02 # v5.0.0
with:
pages_threshold: major_outage
- name: Setup Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
- name: Upload static files as artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
# Upload _site directory only.
path: _site/
deploy:
needs: update
# Don't run on forks.
if: github.repository == 'PHPCSStandards/schema.phpcodesniffer.com' && github.event_name != 'pull_request' && needs.update.result == 'success'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
name: "Deploy the website"
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0