Skip to content
This repository was archived by the owner on Aug 31, 2024. It is now read-only.

Commit a217848

Browse files
committed
feat: Add version control
1 parent 0f8e1de commit a217848

File tree

4 files changed

+275
-5
lines changed

4 files changed

+275
-5
lines changed

composer.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"laravel/jetstream": "^v2.12.6",
1313
"laravel/sanctum": "^v3.0.1",
1414
"laravel/tinker": "^v2.7.3",
15-
"livewire/livewire": "^v2.10.7"
15+
"livewire/livewire": "^v2.10.7",
16+
"pragmarx/version": "^1.3"
1617
},
1718
"require-dev": {
1819
"fakerphp/faker": "^v1.20.0",
@@ -36,7 +37,8 @@
3637
"scripts": {
3738
"post-autoload-dump": [
3839
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
39-
"@php artisan package:discover --ansi"
40+
"@php artisan package:discover --ansi",
41+
"@php artisan version:refresh"
4042
],
4143
"post-update-cmd": [
4244
"@php artisan vendor:publish --tag=laravel-assets --ansi --force"

composer.lock

Lines changed: 208 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/version.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
mode: 'absorb' # or 'increment'
2+
blade-directive: version
3+
current:
4+
label: v
5+
major: 1
6+
minor: 0
7+
patch: 0
8+
prerelease:
9+
buildmetadata:
10+
commit: 100001
11+
timestamp:
12+
mode: absorb
13+
year:
14+
month:
15+
day:
16+
hour:
17+
minute:
18+
second:
19+
timezone:
20+
commit:
21+
mode: absorb
22+
length: 6
23+
increment-by: 1
24+
git:
25+
from: 'local' # or "remote"
26+
commit:
27+
local: 'git rev-parse --verify HEAD'
28+
remote: 'git ls-remote {$repository}'
29+
branch: refs/heads/master
30+
repository: '' ### you can use config() to get it here: {{ config('version.git.remote.repository') }}. Do not use env()
31+
version:
32+
local: 'git describe'
33+
remote: 'git ls-remote {$repository} | grep tags/ | grep -v {} | cut -d / -f 3 | sort --version-sort | tail -1'
34+
matcher: '/^(?P<label>[v|V]*[er]*[sion]*)[\.|\s]*(?P<major>0|[1-9]\d*)\.(?P<minor>0|[1-9]\d*)\.(?P<patch>0|[1-9]\d*)(?:-(?P<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/'
35+
timestamp:
36+
local: 'git show -s --format=%ci'
37+
remote: 'git show -s --format=%ci origin/master' ## we will have to find a better way
38+
format:
39+
regex:
40+
optional_bracket: '\[(?P<prefix>.*?)(?P<spaces>\s*)(?P<delimiter>\?\=)(?P<optional>.*?)\]'
41+
label: "{$label}"
42+
major: "{$major}"
43+
minor: "{$minor}"
44+
patch: "{$patch}"
45+
prerelease: "{$prerelease}"
46+
buildmetadata: "{$buildmetadata}"
47+
commit: "{$commit}"
48+
version: 'version {$major}.{$minor}.{$patch} (commit {$commit})'
49+
version-only: 'version {$major}.{$minor}.{$patch}'
50+
## Bracket enclosed expressions "[.?{$variable}]" are only rendered if the ?={$variable} is filled
51+
full: '{$version-only}[.?={$prerelease}][+?={$buildmetadata}] (commit {$commit})'
52+
compact: "v{$major}.{$minor}.{$patch}-{$commit}"
53+
timestamp-year: '{$timestamp.year}'
54+
timestamp-month: '{$timestamp.month}'
55+
timestamp-day: '{$timestamp.day}'
56+
timestamp-hour: '{$timestamp.hour}'
57+
timestamp-minute: '{$timestamp.minute}'
58+
timestamp-second: '{$timestamp.second}'
59+
timestamp-timezone: '{$timestamp.timezone}'
60+
timestamp-datetime: '{$timestamp.year}-{$timestamp.month}-{$timestamp.day} {$timestamp.hour}:{$timestamp.minute}:{$timestamp.second}'
61+
timestamp-full: '{$timestamp.year}-{$timestamp.month}-{$timestamp.day} {$timestamp.hour}:{$timestamp.minute}:{$timestamp.second} {$timestamp.timezone}'
62+
## add as many formats as you need !!!!

resources/views/layouts/app.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
</head>
2424
<body class="font-sans antialiased">
2525
@if( !App::environment(['Production','prd','PROD']))
26-
<div class="md:visible ribbon ribbon-top-left"><span>{{App::environment()}} Test</span></div>
26+
<div class="md:visible ribbon ribbon-top-left"><span>{{App::environment()}} Test @version</span></div>
2727
@endif
2828
<x-jet-banner/>
2929

0 commit comments

Comments
 (0)