This template project is intended for tesing gomplate
for use with a GitHub Template.
The gomplate CLI must be installed and available on your PATH
.
For example, using go install
to install gomplate
:
go install github.com/hairyhenderson/gomplate/v3/cmd/gomplate@latest
Verify gomplate is successfully installed and available on your PATH
:
$ gomplate --version
gomplate version 0.0.0
-
Create a new repository in GitHub and select this template as the "Repository template".
-
After creating the new repository, clone it locally.
-
From the local repository root folder, create and switch to a new branch, for example
pr-init-template
:git switch -c pr-init-template
-
Modify the included
skeleton-data.yaml
input data file with the appropriate substitution values for the provided properties for your new project. -
Run the following command to run gomplate, which will place the templatized folders and files into the
./out
directory.gomplate --verbose
-
Next, stash your input data file in case it is needed later to start over:
git stash push -m "input data backup" -- skeleton-data.yaml
-
Replace the contents of the static template files with the templatized folders and files from the
./out
directory.ls -A | grep -xv "out" | grep -xv ".git" | xargs rm -rf && \ mv -vf out/{.,}* . ; \ rm -r out
-
If you need to start the templatization process over, reset the git index to origin/main.
NOTE: Backup files if necessary first, this will delete all local changes.
git reset --hard origin/main && git clean -dfx
The input data file can then be recovered from the stash to start over with.
git stash apply
-
-
When satisified with the results, commit, push, and create the first Pull Request!
git add -A git status git commit -m "ci: initial templatization" git push -u origin pr-init-template