Skip to content

Fetches version info from a github repo and append it to a custom header.

Notifications You must be signed in to change notification settings

jersak/lib-laravel-git-versioning

Repository files navigation

Maintainability Test Coverage

lib-laravel-git-versioning

Descriptioin

This package pulls versioning information from github through an artisan command and appends it to the response headers on every api call through a middleware.

Installation

.env file

Set three new variables:

  • GITHUB_ORG_NAME: name of your organization or personal github account (eg: Jersak)
  • GITHUB_REPO_NAME: name of your repository (eg: lib-laravel-git-versioning)
  • GITHUB_TOKEN: Github access token. 'repo:status' permission should suffice.

composer.json

"require": {
    "Jersak/lib-laravel-git-versioning": "0.*",
}
...
"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/Jersak/lib-laravel-git-versioning"
    }
],

bootstrap/app.php

$app->middleware([
	Jersak\Versioning\VersionHeaderMiddleware::class,
]);

$app->register('Jersak\Versioning\VersioningServiceProvider');

Pull versioning information On the CLI, run:

php artisan github:getversion -S <commit or version SHA>

What does it add?

A header to every request called 'X-App-Version' containing either the version of the application if a released version is being used (such as v0.1) or the SHA of the commit.

About

Fetches version info from a github repo and append it to a custom header.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages