Skip to content

GH Actions/verify release: tweak the workflow #1092

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 28 additions & 20 deletions .github/workflows/verify-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
verify-available-downloads:
runs-on: ubuntu-latest

# Only run this workflow in the context of this repo.
if: github.repository_owner == 'PHPCSStandards'
# Only run this workflow in the context of this repo.
if: github.repository_owner == 'PHPCSStandards'

strategy:
fail-fast: false
Expand Down Expand Up @@ -109,9 +109,11 @@ jobs:
ini-values: error_reporting=-1, display_errors=On
coverage: none

# Note: the `.` is in the command to make it work for both PHPCS as well PHPCBF.
- name: Create a PHP file
run: echo '<?php echo "Hello, World!";' > hello.php

- name: Verify the PHAR is nominally functional
run: php ${{ steps.source.outputs.FILE }} . -e --standard=PSR12
run: php ${{ steps.source.outputs.FILE }} -- -ps hello.php --standard=PSR2

- name: Grab the version
id: asset_version
Expand All @@ -133,8 +135,8 @@ jobs:
verify-phive:
runs-on: ubuntu-latest

# Only run this workflow in the context of this repo.
if: github.repository_owner == 'PHPCSStandards'
# Only run this workflow in the context of this repo.
if: github.repository_owner == 'PHPCSStandards'

strategy:
fail-fast: false
Expand All @@ -146,24 +148,28 @@ jobs:
name: "PHIVE: ${{ matrix.pharfile }}"

steps:
- name: Retrieve latest release info
uses: octokit/[email protected]
id: get_latest_release
with:
route: GET /repos/PHPCSStandards/PHP_CodeSniffer/releases/latest
# Phive does not support a stability flag yet, so it will always download the
# very latest release, even when this is a pre-release.
# I.e. to verify the downloaded version, we need to select the version number including pre-releases.
# Ref: https://github.com/phar-io/phive/issues/154
- name: Retrieve latest release info (including prereleases)
id: latest_release
run: |
latestRelease="$(gh release list --repo PHPCSStandards/PHP_CodeSniffer --limit 1 --json tagName --jq '.[0].tagName')"
echo "TAG=$latestRelease" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: "DEBUG: Show API request failure status"
if: ${{ failure() }}
run: "echo No release found. Request failed with status ${{ steps.get_latest_release.outputs.status }}"
- name: "DEBUG: Show tag name found in API response"
run: "echo ${{ steps.latest_release.outputs.TAG }}"

- name: Grab latest tag name from API response
# Just get the version number, without alpha/beta/RC.
- name: Clean up the version number
id: version
run: |
echo "TAG=${{ fromJson(steps.get_latest_release.outputs.data).tag_name }}" >> "$GITHUB_OUTPUT"
# yamllint disable-line rule:line-length
run: echo "TAG=$(echo '${{ steps.latest_release.outputs.TAG }}' | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+(\.[0-9]+)+')" >> "$GITHUB_OUTPUT"

- name: "DEBUG: Show tag name found in API response"
- name: "DEBUG: Show cleaned up tag name"
run: "echo ${{ steps.version.outputs.TAG }}"

- name: Setup PHP
Expand All @@ -186,9 +192,11 @@ jobs:
GH_TOKEN: ${{ github.token }}
GH_FORCE_TTY: true

# Note: the `.` is in the command to make it work for both PHPCS as well PHPCBF.
- name: Create a PHP file
run: echo '<?php echo "Hello, World!";' > hello.php

- name: Verify the PHAR is nominally functional
run: php ./tools/${{ matrix.pharfile }} . -e --standard=PSR12
run: php ./tools/${{ matrix.pharfile }} -- -ps hello.php --standard=PSR2

- name: Grab the version
id: asset_version
Expand Down