File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed
Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 2929 steps :
3030 - name : Checkout code
3131 uses : actions/checkout@v4
32+ with :
33+ ref : ${{ inputs.tag_name || github.ref }}
34+ fetch-tags : true
3235
3336 - name : Setup PHP
3437 uses : shivammathur/setup-php@v2
5457
5558 - name : Build PHAR
5659 run : php build.php
60+ env :
61+ BUILD_VERSION : ${{ inputs.tag_name }}
5762
5863 - name : Test PHAR
5964 run : |
Original file line number Diff line number Diff line change 2727$ buildDir = __DIR__ . '/build ' ;
2828$ pharFile = $ buildDir . '/oce-import-codes.phar ' ;
2929
30- echo "Building oce-import-codes.phar... \n" ;
30+ // Determine version: BUILD_VERSION env var > git describe > fallback
31+ $ version = getenv ('BUILD_VERSION ' ) ?: null ;
32+ if (!$ version ) {
33+ $ version = trim ((string ) shell_exec ('git describe --tags 2>/dev/null ' )) ?: 'dev ' ;
34+ }
35+
36+ echo "Building oce-import-codes.phar (version: $ version)... \n" ;
3137
3238// Create build directory
3339if (!is_dir ($ buildDir )) {
4551 // Set metadata
4652 $ phar ->setMetadata ([
4753 'name ' => 'oce-import-codes ' ,
48- 'version ' => ' 1.0.0 ' ,
54+ 'version ' => $ version ,
4955 'created ' => date ('Y-m-d H:i:s ' )
5056 ]);
5157
You can’t perform that action at this time.
0 commit comments