From 44ae69aa2bc24cf5247c8e6455f0684e27c364e5 Mon Sep 17 00:00:00 2001 From: Robert McGovern Date: Sat, 22 Jan 2022 23:34:46 +0000 Subject: [PATCH] test of post-receive hook --- .eslintrc.js | 11 +++++++++++ post-receive | 11 +++++++++++ 2 files changed, 22 insertions(+) create mode 100644 .eslintrc.js create mode 100644 post-receive diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 0000000..cf0e337 --- /dev/null +++ b/.eslintrc.js @@ -0,0 +1,11 @@ +module.exports = { + env: { + browser: true, + es2021: true, + }, + extends: "eslint:recommended", + parserOptions: { + ecmaVersion: "latest", + }, + rules: {}, +}; diff --git a/post-receive b/post-receive new file mode 100644 index 0000000..4c089cc --- /dev/null +++ b/post-receive @@ -0,0 +1,11 @@ +#!/bin/bash +while read oldrev newrev ref +do + if [[ $ref =~ .*/main$ ]]; + then + echo "Main ref received. Deploying main branch to production..." + git --work-tree=/srv/http/galshaw.eu --git-dir=/srv/git/galshaw.eu.git checkout -f + else + echo "Ref $ref successfully received. Doing nothing: only the main branch may be deployed on this server." + fi +done