Skip to content

GH Actions: Bump stefanzweifel/git-auto-commit-action from 6.0.1 to 7.0.0 #77

GH Actions: Bump stefanzweifel/git-auto-commit-action from 6.0.1 to 7.0.0

GH Actions: Bump stefanzweifel/git-auto-commit-action from 6.0.1 to 7.0.0 #77

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:
name: "Update XSD files"
# Don't run on forks.
if: github.repository == 'PHPCSStandards/schema.phpcodesniffer.com'
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
ref: ${{ steps.base_branch.outputs.BRANCH }}
- name: Install PHP
uses: shivammathur/setup-php@bf6b4fbd49ca58e4608c9c89fba0b8d90bd2a39f # 2.35.5
with:
php-version: '8.4'
ini-values: error_reporting=-1, display_errors=On, display_startup_errors=On, log_errors_max_len=0
coverage: none
- 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@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0
with:
commit_message: "Update XSD files"
add_options: '-A'
- name: Check GitHub Pages status
uses: crazy-max/ghaction-github-status@fa6ac37620bc5d44b93e15caed498629665e9ff5 # v4.2.0
with:
pages_threshold: major_outage
- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0
- name: Upload static files as artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4.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'
name: "Deploy the website"
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5