All Projects → pedroborges → Kirby Autogit

pedroborges / Kirby Autogit

⬢ Saves every change made via Kirby Panel to a Git repository

Projects that are alternatives of or similar to Kirby Autogit

kirby-blade
Enable Laravel Blade Template Engine for Kirby 3
Stars: ✭ 20 (-86.39%)
Mutual labels:  kirby, kirby-plugin
Select A Structure
A select field for Kirby populated by a structure field.
Stars: ✭ 44 (-70.07%)
Mutual labels:  kirby, kirby-plugin
search-for-kirby
Kirby 3 plugin for adding a search index (sqlite or Algolia).
Stars: ✭ 42 (-71.43%)
Mutual labels:  kirby, kirby-plugin
retour-for-kirby
Kirby 3 plugin to manage redirects and track 404s right from the Panel
Stars: ✭ 96 (-34.69%)
Mutual labels:  kirby, kirby-plugin
Kirby Typography
Typographic enhancements for your Kirby-driven website.
Stars: ✭ 80 (-45.58%)
Mutual labels:  kirby, kirby-plugin
kirby-architect
📐 Easily reference Blueprint data from anywhere in your Kirby application.
Stars: ✭ 38 (-74.15%)
Mutual labels:  kirby, kirby-plugin
Kirby Sri
Subresource integrity hashing & cache-busting static assets for Kirby
Stars: ✭ 9 (-93.88%)
Mutual labels:  kirby, kirby-plugin
kirby3-many-to-many-field
This plugin allows you to create many-to-many relationships between pages in Kirby and synchronizes them on both sides.
Stars: ✭ 38 (-74.15%)
Mutual labels:  kirby, kirby-plugin
Kirby Calendar Plugin
A plugin for the Kirby CMS to easily implement an event calendar.
Stars: ✭ 76 (-48.3%)
Mutual labels:  kirby, kirby-plugin
Embed
Media embed plugin for Kirby 2 CMS
Stars: ✭ 73 (-50.34%)
Mutual labels:  kirby, kirby-plugin
queue-for-kirby
Basic queue for Kirby 2, using Cron and Kirby's flat file system
Stars: ✭ 17 (-88.44%)
Mutual labels:  kirby, kirby-plugin
Kirby Imagekit
Asynchronous thumbnail creation and optimization for Kirby 2
Stars: ✭ 109 (-25.85%)
Mutual labels:  kirby, kirby-plugin
kirbyup
🆙 Zero-config bundler for Kirby Panel plugins
Stars: ✭ 33 (-77.55%)
Mutual labels:  kirby, kirby-plugin
Cartkit
Cartkit - The [quick] starter kit!
Stars: ✭ 39 (-73.47%)
Mutual labels:  kirby, kirby-plugin
kirby-file-types
Show file fields only for specific file types
Stars: ✭ 13 (-91.16%)
Mutual labels:  kirby, kirby-plugin
kirby-copy-files
Clone page dashboard widget for Kirby panel
Stars: ✭ 12 (-91.84%)
Mutual labels:  kirby, kirby-plugin
kirby-backup-widget
Kirby panel widget to easily backup your site content.
Stars: ✭ 25 (-82.99%)
Mutual labels:  backup, kirby
kirby-boiler-field
Boilerplate for Kirby form fields
Stars: ✭ 15 (-89.8%)
Mutual labels:  kirby, kirby-plugin
Panel Bar
panelBar for Kirby 2 CMS
Stars: ✭ 70 (-52.38%)
Mutual labels:  kirby, kirby-plugin
Field Multiselect
Multiselect field for Kirby 2 CMS
Stars: ✭ 84 (-42.86%)
Mutual labels:  kirby, kirby-plugin

Kirby Auto Git Release Issues

Saves every change made via Kirby Panel to a Git repository.

Main features

  • Works with any Kirby structure
  • Auto-generates commits
  • Webhook URLs for pull and push events
  • Panel widget to push and pull manually
  • Localized commit messages
  • Uses panel user as commit author

Installation

Requirements

  • Git
  • Kirby 2.3.2+
  • PHP 5.6+

Site Structure

You can use whatever site structure fits your needs better. It doesn't matter whether your content folder is part of the main Git repo or is a submodule. Auto Git is smart enough to only commit changes made inside the content folder.

Internally Auto Git uses kirby()->roots()->content() to detect the content folder. It can be whatever name you've registered on your Kirby installation.

If there's anything that you don't want to commit inside the content folder, make sure to add it to .gitignore.

Download

Download the files and place them inside site/plugins/autogit.

Kirby CLI

Kirby's command line interface makes installing the Auto Git a breeze:

$ kirby plugin:install pedroborges/kirby-autogit

Updating couldn't be any easier, simply run:

$ kirby plugin:update pedroborges/kirby-autogit

Git Submodule

You can add the Auto Git as a Git submodule.

Show Git Submodule instructions 👁

$ cd your/project/root
$ git submodule add https://github.com/pedroborges/kirby-autogit.git site/plugins/autogit
$ git submodule update --init --recursive
$ git commit -am "Add Kirby Auto Git"

Updating is as easy as running a few commands.

$ cd your/project/root
$ git submodule foreach git checkout master
$ git submodule foreach git pull
$ git commit -am "Update submodules"
$ git submodule update --init --recursive

Options

The following options can be set in your /site/config/config.php:

c::set('autogit',                true);
c::set('autogit.remote.name',    'origin');
c::set('autogit.remote.branch',  'master');

c::set('autogit.webhook.secret', false);
c::set('autogit.webhook.url',    'autogit');

c::set('autogit.panel.user',     true);
c::set('autogit.user.name',      'Auto Git');
c::set('autogit.user.email',     '[email protected]');

c::set('autogit.widget',         true);

c::set('autogit.language',       'en');
c::set('autogit.translation', [
    'site.update'  => 'Changed site options',
    'page.create'  => 'Created page %s',
    'page.update'  => 'Updated page %s',
    'page.delete'  => 'Deleted page %s',
    'page.sort'    => 'Sorted page %s',
    'page.hide'    => 'Hid page %s',
    'page.move'    => 'Moved page %1$s to %2$s',
    'file.upload'  => 'Uploaded file %s',
    'file.replace' => 'Replaced file %s',
    'file.rename'  => 'Renamed file %s',
    'file.update'  => 'Updated file %s',
    'file.sort'    => 'Sorted file %s',
    'file.delete'  => 'Deleted file %s',
]);

autogit

Auto Git will always run by defaut, but you can disable it in any environment by setting this option to false.

c::set('autogit', false);

autogit.remote.name

Which remote repository to use. Defaults to origin.

Auto Git won't add the remote repo for you. You must manually add one to your server.

autogit.remote.branch

Which remote branch to use when pulling and pushing. Defaults to master.

autogit.webhook.secret

Auto Git provides a webhook which you can use to trigger pull and push commands from other services. The webhook will be activated only when a secret has been defined:

// Pick a long string
c::set('autogit.webhook.secret', 'MySuperSecret');

After that, the following URLs will be available to you:

https://yousite.com/autogit/pull?secret=MySuperSecret
https://yousite.com/autogit/push?secret=MySuperSecret

Don't forget to pass the secret as an argument.

Webhooks we only be enabled when the remote repository defined in the autogit.remote.name option exists. Add one by running git remote add <name> <url>.

To pull changes on your server every time the remote repo receives a new push, go to your repo on Bitbucket/Github/Gitlab then navigate to settings > webhooks > add webhook (these steps are almost the same across all providers).

  • URL: https://yousite.com/autogit/pull?secret=MySuperSecret
  • Secret: leave blank
  • Events/triggers: select push only
  • Status: active
  • SSL: enable (if your site supports it)

Alternatively you can schedule a cron job to run git push and/or git pull frequently.

autogit.webhook.url

Change the webhook URL segment to something else. Defaults to autogit.

// https://yousite.com/webhook/pull?secret=MySuperSecret
c::set('autogit.webhook.url', 'webhook');

autogit.panel.user

Defines if Auto Git should use Kirby's panel user name and email as commit author. This will enable you to see who made each change in your Git client of choice or simply by running git log. The user must have entered first name and email in their account profile.

User detail

Options autogit.user.name and autogit.user.email will be overridden when this is set to true.

autogit.user.name

Default commit author name. Applied only when the option autogit.panel.user is set to false or when the user first name is not defined in their account profile.

autogit.user.email

Default commit author email. Applied only when the option autogit.panel.user is set to false or when the user first name is not defined in their account profile.

autogit.widget

Auto Git will add a widget to the Panel by default, set this option to false to hide it.

Auto Git widget

In case a remote repository doesn't exist, the widget will only display an error message. Run git remote add <name> <url> to enable this feature.

autogit.language

Default commit language. You can choose from any of the languages that ships with Auto Git: 'en', 'pt_BR' or 'pt_PT'.

You can also use the autogit.translation option to provide a custom translation (see below).

Other languages are more than welcome. Feel free to send a pull request!

autogit.translation

An array containing a custom translation. This will override the default translation set in autogit.language.

Roadmap

  • [X] Pull and push webhooks
  • [X] Panel widget (pull/push buttons)
  • [X] Trigger pull and push events
  • [ ] Panel widget (show commit history)
  • [ ] Panel widget (undo button)
  • [ ] Panel widget (show commit diff)

Change Log

All notable changes to this project will be documented at: https://github.com/pedroborges/kirby-autogit/blob/master/changelog.md

License

Auto Git is open-sourced software licensed under the MIT license.

Copyright © 2018 Pedro Borges [email protected]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].