Skip to content

Release

Release #121

Workflow file for this run

---
name: Release
on:
workflow_dispatch:
# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#onworkflow_dispatchinputs
inputs:
operating-system:
description: "OS name and version runtime"
required: false
default: "ubuntu-22.04"
type: string
php-version:
description: "PHP runtime version in format Major.minor"
required: false
default: "8.2"
type: string
composer-options:
description: "Composer options for ramsey/composer-install GitHub Action"
required: false
default: "--prefer-dist --no-scripts"
type: string
box-output:
description: "Path to the PHP Archive made by the BOX"
required: true
default: "bin/compatinfo-db.phar"
type: string
box-manifest-version:
# https://github.com/llaville/box-manifest
description: "BOX Manifest runtime version in semver format"
required: false
default: "4.2.0"
type: string
box-manifest-options:
description: "Additional options to pass to BOX Manifest (e.g. `--bootstrap bootstrap.php -r plain.txt -r sbom.json`)"
required: false
default: "-r console-table.txt -r plain.txt -r sbom.json"
type: string
tag-name:
description: "New Release Tag"
required: false
default: ""
type: string
permissions:
contents: write
jobs:
lint_files:
uses: ./.github/workflows/mega-linter.yml
with:
operating-system: ${{ inputs.operating-system }}
php-version: ${{ inputs.php-version }}
composer-options: ${{ inputs.composer-options }}
unit_tests:
uses: ./.github/workflows/unit-tests.yml
with:
operating-system: ${{ inputs.operating-system }}
composer-options: ${{ inputs.composer-options }}
create_release:
if: inputs.tag-name != ''
needs:
- lint_files
- unit_tests
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ${{ inputs.operating-system }}
php:
- ${{ inputs.php-version }}
tools:
- box:4.6 # available since https://github.com/shivammathur/setup-php/releases/tag/2.27.0
steps:
- # https://github.com/actions/checkout
name: Checkout
uses: actions/[email protected]
with:
# Make sure the value of GITHUB_TOKEN will not be persisted in repo's config
persist-credentials: false
- # https://github.com/shivammathur/setup-php
name: Setup PHP runtime
uses: shivammathur/[email protected]
with:
php-version: ${{ matrix.php }}
coverage: "none"
tools: ${{ matrix.tools }}
- # https://getcomposer.org/doc/06-config.md#platform
name: Setup Composer Platform
run: |
composer config platform.php 8.1
- # https://github.com/ramsey/composer-install
name: Install Composer dependencies
uses: ramsey/[email protected]
with:
dependency-versions: "highest"
composer-options: ${{ inputs.composer-options }}
- # https://github.com/llaville/box-manifest
name: Download BOX Manifest Artifact
env:
BOX_MANIFEST_VERSION: ${{ inputs.box-manifest-version }}
run: |
curl -Ls "https://github.com/llaville/box-manifest/releases/download/$BOX_MANIFEST_VERSION/box-manifest.phar" -o /usr/local/bin/box-manifest
chmod +x /usr/local/bin/box-manifest
- # https://github.com/llaville/box-manifest
name: Build Release Artifact
run: |
box-manifest make build stub configure ${{ inputs.box-manifest-options }} --output-stub stub.php --output-conf box.json.dist -vvv --ansi
box compile -c box.json.dist -vvv --ansi
- # https://github.com/softprops/action-gh-release
name: Create Release from current tag
uses: softprops/[email protected]
with:
# https://github.com/softprops/action-gh-release#-customizing
prerelease: false
draft: false
body_path: ${{ github.workspace }}/.changes/6.x/${{ inputs.tag-name }}.md
# https://github.com/softprops/action-gh-release#%EF%B8%8F-uploading-release-assets
files: ${{ github.workspace }}/${{ inputs.box-output }}
fail_on_unmatched_files: true
tag_name: ${{ inputs.tag-name }}