Browse Source
Allow to deploy from non-default repo and branch
Closes #6
pull/16/head
Matīss Treinis
4 years ago
No known key found for this signature in database
GPG Key ID: 9123B913EBF53D43
2 changed files with
16 additions and
3 deletions
-
Makefile
-
kafe.lua
|
|
@ -1,6 +1,8 @@ |
|
|
|
ROOT_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST)))) |
|
|
|
CURRENT_UID := $(shell id -u) |
|
|
|
CURRENT_GID := $(shell id -g) |
|
|
|
TARGET_REPO ?= "git@github.com:AlmaLinux/almalinux.org.git" |
|
|
|
TARGET_BRANCH ?= "master" |
|
|
|
|
|
|
|
.PHONY: default |
|
|
|
default: dev ; |
|
|
@ -56,7 +58,7 @@ assemble: # INTERNAL: assemble deployment asset for deployment |
|
|
|
rm -rf tmp/deploy_out |
|
|
|
mkdir -p tmp |
|
|
|
mkdir -p tmp/deploy_out |
|
|
|
git clone git@github.com:AlmaLinux/almalinux.org.git tmp/deploy |
|
|
|
git clone ${TARGET_REPO} tmp/deploy --branch ${TARGET_BRANCH} |
|
|
|
# Use local install .venv and node_modules to reuse local install as sort of a cache |
|
|
|
cp -R .venv tmp/deploy |
|
|
|
cp -R frontend/node_modules tmp/deploy/frontend |
|
|
|
|
|
@ -6,14 +6,25 @@ k.require_api(1) |
|
|
|
k.add_inventory('deploy', '18.213.64.210', 22, 'staging', 'website') |
|
|
|
k.add_inventory('deploy', '3.210.88.35', 22, 'production', 'website') |
|
|
|
|
|
|
|
k.task('deploy', function() |
|
|
|
k.task('deploy', function(repo, branch) |
|
|
|
local version = os.time(os.date('!*t')) |
|
|
|
|
|
|
|
k.define('deploy_to', '/opt/almalinux.org') |
|
|
|
k.define('public', '/var/www/almalinux.org') |
|
|
|
k.define('version', version) |
|
|
|
|
|
|
|
k.local_shell('make assemble') |
|
|
|
if repo == nil then |
|
|
|
repo = 'git@github.com:AlmaLinux/almalinux.org.git' |
|
|
|
end |
|
|
|
|
|
|
|
if branch == nil then |
|
|
|
branch = 'master' |
|
|
|
end |
|
|
|
|
|
|
|
k.define('repo', repo) |
|
|
|
k.define('branch', branch) |
|
|
|
|
|
|
|
k.local_shell('TARGET_REPO={{repo}} TARGET_BRANCH={{branch}} make assemble') |
|
|
|
|
|
|
|
local deploy = function() |
|
|
|
k.within('{{deploy_to}}') |
|
|
|