Skip to content

Release new version #5542

Release new version

Release new version #5542

Workflow file for this run

name: Release new version
on:
push:
paths:
- ".github/workflows/release.yml"
schedule:
# Once a day. WordPress.org releases do not warrant an hourly poll, and an
# hourly schedule floods the notification inbox whenever a run fails.
- cron: '0 3 * * *'
workflow_dispatch:
permissions:
contents: write
jobs:
release-new-stubs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
# The release script skips versions that are already tagged, so the
# full history and every tag have to be present.
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
# The runner default is 7.4, but --ignore-platform-reqs lets Composer
# resolve PHPUnit 11 / Symfony 7, which are PHP 8.2+ code. The
# generator then dies parsing its own vendor tree.
php-version: '8.3'
extensions: json zip xdebug
coverage: none
tools: composer
- name: Get Composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: "${{ runner.os }}-${{ hashFiles('**/composer.lock') }}"
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --prefer-dist --no-progress --no-interaction --ignore-platform-reqs
- name: Set up Git user
run: |
git config user.name 'github-actions'
git config user.email 'github-actions@github.com'
- name: Release new stubs from latest version
run: bash bin/release-latest-versions.sh
- name: Push new stubs and tags
run: |
set -euo pipefail
if [ "$(git rev-list --count origin/main..HEAD)" -eq 0 ]; then
echo "No new versions to release."
exit 0
fi
git push origin main
# Push only the tags the release script just created; everything else
# is already published.
git ls-remote --tags origin \
| sed -n 's#.*refs/tags/\([^^]*\)$#\1#p' | sort -u > /tmp/remote-tags
git tag | sort -u > /tmp/local-tags
while IFS= read -r tag; do
[ -n "$tag" ] || continue
echo "Pushing $tag"
git push origin "refs/tags/$tag"
done < <(comm -23 /tmp/local-tags /tmp/remote-tags)
shell: bash