Skip to content
Merged
Show file tree
Hide file tree
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
12 changes: 3 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ on:
version:
description: 'SemVer version — no "v" prefix (e.g. 2.1.0)'
required: true
ref:
description: 'Git ref to build from — tag, branch, or SHA (e.g. v2.0.1 or main). Defaults to the tag matching the version.'
required: false
default: ''

# ─── Constants ──────────────────────────────────────────────────────────────
env:
Expand Down Expand Up @@ -46,12 +42,10 @@ jobs:
# Always check out master for build tooling (box.json, humbug/box).
# The PHP source is overlaid from the release ref below.

- name: Overlay PHP source from release ref
- name: Stamp version constant
run: |
REF="${{ inputs.ref != '' && inputs.ref || format('v{0}', inputs.version) }}"
git fetch --tags
git checkout "$REF" -- src/
echo "PHP source overlaid from $REF"
printf '<?php\nnamespace DBDiff;\nconst VERSION = '\''%s'\'';\n' '${{ inputs.version }}' > src/Version.php
echo "Version stamped as ${{ inputs.version }}"

- uses: shivammathur/setup-php@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion box.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"output": "dist/dbdiff.phar",
"compression": "GZ",
"chmod": "0755",
"check-requirements": false,
"check-requirements": true,
"finder": [
{ "in": "src" },
{
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
},
"scripts": {
"post-install-cmd": "scripts/post-install.sh",
"post-update-cmd": "scripts/post-install.sh"
"post-update-cmd": "scripts/post-install.sh",
"build:phar": "vendor/bin/box compile"
},
"support": {
"email": "[email protected]"
Expand Down
3 changes: 2 additions & 1 deletion dbdiff.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require __DIR__ . '/vendor/autoload.php';

use DBDiff\Migration\Command\DiffCommand;

use DBDiff\Migration\Command\MigrationNewCommand;
use DBDiff\Migration\Command\MigrationUpCommand;
use DBDiff\Migration\Command\MigrationDownCommand;
Expand All @@ -12,7 +13,7 @@
use DBDiff\Migration\Command\MigrationBaselineCommand;
use Symfony\Component\Console\Application;

$app = new Application('DBDiff', '2.0.0');
$app = new Application('DBDiff', \DBDiff\VERSION);

$app->addCommands([
new DiffCommand,
Expand Down
12 changes: 12 additions & 0 deletions src/Version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

namespace DBDiff;

/**
* Application version.
*
* This constant is stamped by the release workflow before Box compiles the
* PHAR, so it always matches the dispatched version number. During local
* development it falls back to 'dev'.
*/
const VERSION = 'dev';