[RELEASE] Releasing v1.0.1 #42
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Testing and SemVer-Releasing stable versions as tags | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
php-lint: | |
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, '[RELEASE]')" | |
name: "PHP linter" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "${{ matrix.php-version }}" | |
coverage: none | |
tools: composer:v2.5 | |
- name: "Run PHP lint" | |
run: "composer lint:php" | |
strategy: | |
fail-fast: false | |
matrix: | |
php-version: | |
- 8.1 | |
php-codequality: | |
if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, '[RELEASE]')" | |
name: "Code quality checks" | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Checkout" | |
uses: actions/checkout@v3 | |
- name: "Install PHP" | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: "${{ matrix.php-version }}" | |
coverage: none | |
tools: composer:v2.5 | |
- name: "Show Composer version" | |
run: composer --version | |
- name: "Cache dependencies installed with composer" | |
uses: actions/cache@v3 | |
with: | |
key: "php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}" | |
path: ~/.cache/composer | |
restore-keys: "php${{ matrix.php-version }}-composer-\n" | |
- name: "Install Composer dependencies" | |
run: "composer install --no-progress" | |
- name: "Run command" | |
run: "composer ${{ matrix.command }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
command: | |
- "normalize" | |
- "run lint:php-cs-fixer:dry-run" | |
- "run lint:phpcs:dry-run" | |
- "run lint:phpstan:ci" | |
php-version: | |
- 8.1 | |
calculate-version: | |
name: "calculating next SemVer" | |
runs-on: ubuntu-22.04 | |
needs: [ php-lint,php-codequality ] | |
if: github.ref == 'refs/heads/main' | |
outputs: | |
majorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }} # To use an output in another job, you have to map it to a job output. | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.PAT }} | |
fetch-depth: 0 | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/setup@v0 | |
with: | |
versionSpec: '5.x' | |
- name: Determine GitVersion | |
id: gitversion | |
uses: gittools/actions/gitversion/execute@v0 | |
with: | |
useConfigFile: true | |
- name: Display GitVersion outputs | |
run: | | |
echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}" | |
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}" | |
echo "FullSemVer: ${{ steps.gitversion.outputs.FullSemVer }}" | |
echo "Major: ${{ steps.gitversion.outputs.major }}" | |
echo "Minor: ${{ steps.gitversion.outputs.minor }}" | |
echo "Patch: ${{ steps.gitversion.outputs.patch }}" | |
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}" | |
- name: Set Git User and Mail | |
run: | | |
git config user.name "GitHub Actions Bot" | |
git config user.email "<>" | |
- name: Composer install | |
uses: php-actions/composer@v6 | |
with: | |
args: --ignore-platform-req=ext-gd --ignore-platform-req=ext-pcntl --ignore-platform-req=ext-zip | |
php_version: "8.1" | |
- name: "Create new tag, updating optional version files" | |
run: | | |
export GIT_LASTTAG="$(git describe --tags --abbrev=0)" | |
export CHANGELOG="$(git log ${GIT_LASTTAG}...HEAD --abbrev=0 --format="%s%n%b")" | |
composer run version:set $GitVersion_MajorMinorPatch || true | |
git commit ext_emconf.php -m "[RELEASE] Releasing v${GitVersion_MajorMinorPatch}" || true | |
git tag v${GitVersion_MajorMinorPatch} -m "[RELEASE] Releasing v${GitVersion_MajorMinorPatch}" -m "" -m "Changes since last release:" -m "${CHANGELOG}" | |
- name: "Publish new tag to GitHub" | |
run: | | |
git push origin v${GitVersion_MajorMinorPatch} | |
git push || true |