diff --git a/.github/workflows/template_inputs_cxx.yml b/.github/workflows/template_inputs_cxx.yml new file mode 100644 index 0000000..d6d17ff --- /dev/null +++ b/.github/workflows/template_inputs_cxx.yml @@ -0,0 +1,14 @@ +default_context: + full_name: X Author Name + email: x-pt@example.com + github_username: x-pt + project_name: My Awesome Project + project_slug: my-awesome-project + package_name: my_awesome_project + project_desc: A nice cxx project + cxx_cmake_version: "3.28" + cxx_standard_version: 20 + cxx_standard_required: true + cxx_extensions_required: false + cxx_project_type: [ "binary", "library" ] + cxx_share_enabled: false diff --git a/.github/workflows/template_values.toml b/.github/workflows/template_values.toml deleted file mode 100644 index 121dc7b..0000000 --- a/.github/workflows/template_values.toml +++ /dev/null @@ -1,20 +0,0 @@ -[values] -gh_uname = "x-pt" - -# cxx template values -cmake_min_version = "3.28" -cxx_proj_desc = "Example of Cxx GitHub template" -cxx_standard_version = "23" -cxx_standard_required = "OFF" -cxx_extensions = "OFF" -cxx_proj_type = "bin" -cxx_lib_type = "static" -cxx_bin_type = "static" - -# go template values -go_proj_desc = "Example of Go GitHub template" -go_version = "1.21" - -# python template values -py_proj_desc = "Example of Python GitHub template" -py_version = "3.12" diff --git a/README.md b/README.md index a4b2060..971926e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # X Project Template -A template for [cargo generate](https://github.com/cargo-generate/cargo-generate) +A template using [CookieCutter](https://github.com/cookiecutter/cookiecutter) that aims to be a starting point suitable for the vast majority of startup projects that will be hosted on GitHub. diff --git a/template/cxx/cookiecutter.json b/template/cxx/cookiecutter.json index b246e8f..f3bd364 100644 --- a/template/cxx/cookiecutter.json +++ b/template/cxx/cookiecutter.json @@ -1,25 +1,29 @@ { "project_name": "My Awesome Project", - "project_slug": "{{ cookiecutter.project_name | trim | slugify }}", + "project_slug": "{{ cookiecutter.project_name | slugify }}", "package_name": "{{ cookiecutter.project_slug | replace('-', '_') }}", - "cmake_min_version": "3.28", + "project_desc": "A nice cxx project", + "full_name": "Firstname Lastname", + "email": "email@example.com", + "github_username": "your-org-or-username", + + + "cxx_cmake_version": "3.28", "cxx_standard_version": "20", "cxx_standard_required": true, "cxx_extensions_required": false, - "project_type": ["binary", "library"], - "is_shared": false, - "short_description": "A nice cxx project", - "github_username": "your-org-or-username", - "full_name": "Firstname Lastname", - "email": "email@example.com", + "cxx_project_type": ["binary", "library"], + "cxx_share_enabled": false, + + "__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}", "__prompts__": { - "project_name": "Select your project name", - "project_slug": "Project slug", - "package_name": "Package name", - "short_description": "Short description", + "project_name": "Enter your project name", + "project_slug": "Generated project identifier (slug)", + "package_name": "Generated package/module name", + "project_desc": "Brief project description", "github_username": "GitHub username or organization", - "full_name": "Author full name", - "email": "Author email" + "full_name": "Author's full name", + "email": "Author's email address" } } diff --git a/template/cxx/{{cookiecutter.project_slug}}/.github/workflows/docker.yml b/template/cxx/{{cookiecutter.project_slug}}/.github/workflows/docker.yml index 70806a0..439a515 100644 --- a/template/cxx/{{cookiecutter.project_slug}}/.github/workflows/docker.yml +++ b/template/cxx/{{cookiecutter.project_slug}}/.github/workflows/docker.yml @@ -27,7 +27,7 @@ jobs: password: {{ "${{ secrets.GITHUB_TOKEN }}" }} - name: Build and Export to Docker - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . load: true @@ -41,7 +41,7 @@ jobs: docker run --rm ghcr.io/{{cookiecutter.__gh_slug}}:${GITHUB_REF_NAME:1} - name: Build and Push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 diff --git a/template/cxx/{{cookiecutter.project_slug}}/CMakeLists.txt b/template/cxx/{{cookiecutter.project_slug}}/CMakeLists.txt index 67a60a9..c699ff8 100644 --- a/template/cxx/{{cookiecutter.project_slug}}/CMakeLists.txt +++ b/template/cxx/{{cookiecutter.project_slug}}/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION {{cookiecutter.cmake_min_version}}) +cmake_minimum_required(VERSION {{cookiecutter.cxx_cmake_version}}) project({{cookiecutter.project_slug}} LANGUAGES CXX) # C++ Standard settings @@ -23,8 +23,8 @@ if(NOT MSVC) endif() # Determine target type -set(IS_BINARY {{ cookiecutter.project_type == "binary" }}) -set(IS_SHARED {{ cookiecutter.is_shared }}) +set(IS_BINARY {{ cookiecutter.cxx_project_type == "binary" }}) +set(IS_SHARED {{ cookiecutter.cxx_share_enabled }}) if(IS_BINARY) add_executable(${PROJECT_NAME} ${SOURCES}) diff --git a/template/cxx/{{cookiecutter.project_slug}}/Dockerfile b/template/cxx/{{cookiecutter.project_slug}}/Dockerfile index 5fa7beb..911d8be 100644 --- a/template/cxx/{{cookiecutter.project_slug}}/Dockerfile +++ b/template/cxx/{{cookiecutter.project_slug}}/Dockerfile @@ -22,7 +22,7 @@ COPY .. . RUN cmake -B build && cmake --build build --target {{cookiecutter.project_slug}} --config Release --parallel 8 # DEPLOYING -{% if cookiecutter.project_type == "binary" and not cookiecutter.is_shared -%} +{% if cookiecutter.cxx_project_type == "binary" and not cookiecutter.cxx_share_enabled -%} FROM scratch {%- else -%} FROM rockylinux:9-minimal diff --git a/template/go/cookiecutter.json b/template/go/cookiecutter.json index 948b4d3..15220f5 100644 --- a/template/go/cookiecutter.json +++ b/template/go/cookiecutter.json @@ -2,20 +2,23 @@ "project_name": "My Awesome Project", "project_slug": "{{ cookiecutter.project_name | slugify }}", "package_name": "{{ cookiecutter.project_slug | replace('-', '_') }}", - "go_version": "1.22", - "short_description": "A nice go project", - "github_username": "your-org-or-username", + "project_desc": "A nice go project", "full_name": "Firstname Lastname", "email": "email@example.com", + "github_username": "your-org-or-username", + + + "go_version": "1.22", + + "__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}", "__prompts__": { - "project_name": "Select your project name", - "project_slug": "Project slug", - "package_name": "Package name", - "go_version": "Go version", - "short_description": "Short description", + "project_name": "Enter your project name", + "project_slug": "Generated project identifier (slug)", + "package_name": "Generated package/module name", + "project_desc": "Brief project description", "github_username": "GitHub username or organization", - "full_name": "Author full name", - "email": "Author email" + "full_name": "Author's full name", + "email": "Author's email address" } } diff --git a/template/go/{{cookiecutter.project_slug}}/.github/workflows/docker.yml b/template/go/{{cookiecutter.project_slug}}/.github/workflows/docker.yml index bdd36af..9ea3007 100644 --- a/template/go/{{cookiecutter.project_slug}}/.github/workflows/docker.yml +++ b/template/go/{{cookiecutter.project_slug}}/.github/workflows/docker.yml @@ -27,7 +27,7 @@ jobs: password: {{ "${{ secrets.GITHUB_TOKEN " }}}} - name: Build and Export to Docker - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . load: true @@ -41,7 +41,7 @@ jobs: docker run --rm ghcr.io/{{cookiecutter.__gh_slug}}:${GITHUB_REF_NAME:1} - name: Build and Push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 diff --git a/template/go/{{cookiecutter.project_slug}}/cmd/root.go b/template/go/{{cookiecutter.project_slug}}/cmd/root.go index e173b79..80c7216 100644 --- a/template/go/{{cookiecutter.project_slug}}/cmd/root.go +++ b/template/go/{{cookiecutter.project_slug}}/cmd/root.go @@ -12,7 +12,7 @@ var cfgFile string var rootCmd = &cobra.Command{ Use: "{{cookiecutter.project_slug}}", - Short: "{{cookiecutter.short_description}}", + Short: "{{cookiecutter.project_desc}}", Long: `A long desc for the {{cookiecutter.project_slug}}. Such as: - Feature1 diff --git a/template/py/cookiecutter.json b/template/py/cookiecutter.json index 6f58ec3..8943426 100644 --- a/template/py/cookiecutter.json +++ b/template/py/cookiecutter.json @@ -1,21 +1,24 @@ { "project_name": "My Awesome Project", - "project_slug": "{{ cookiecutter.project_name | trim | slugify }}", + "project_slug": "{{ cookiecutter.project_name | slugify }}", "package_name": "{{ cookiecutter.project_slug | replace('-', '_') }}", - "python_version": "3.10", - "short_description": "A nice python project", - "github_username": "your-org-or-username", + "project_desc": "A nice python project", "full_name": "Firstname Lastname", "email": "email@example.com", + "github_username": "your-org-or-username", + + + "python_version": "3.10", + + "__gh_slug": "{{ cookiecutter.github_username }}/{{ cookiecutter.project_slug }}", "__prompts__": { - "project_name": "Select your project name", - "project_slug": "Project slug", - "package_name": "Package name", - "python_version": "Python version", - "short_description": "Short description", + "project_name": "Enter your project name", + "project_slug": "Generated project identifier (slug)", + "package_name": "Generated package/module name", + "project_desc": "Brief project description", "github_username": "GitHub username or organization", - "full_name": "Author full name", - "email": "Author email" + "full_name": "Author's full name", + "email": "Author's email address" } } diff --git a/template/py/{{cookiecutter.project_slug}}/.github/workflows/docker.yml b/template/py/{{cookiecutter.project_slug}}/.github/workflows/docker.yml index 9c0a1ed..65e71db 100644 --- a/template/py/{{cookiecutter.project_slug}}/.github/workflows/docker.yml +++ b/template/py/{{cookiecutter.project_slug}}/.github/workflows/docker.yml @@ -30,7 +30,7 @@ jobs: password: {{ "${{ secrets.GITHUB_TOKEN }}" }} - name: Build and Export to Docker - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . load: true @@ -44,7 +44,7 @@ jobs: docker run --rm ghcr.io/{{cookiecutter.__gh_slug}}:${GITHUB_REF_NAME:1} - name: Build and Push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 diff --git a/template/py/{{cookiecutter.project_slug}}/pyproject.toml b/template/py/{{cookiecutter.project_slug}}/pyproject.toml index 050517a..1fbfa69 100644 --- a/template/py/{{cookiecutter.project_slug}}/pyproject.toml +++ b/template/py/{{cookiecutter.project_slug}}/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "hatchling.build" [project] name = "{{cookiecutter.project_slug}}" version = "0.0.1" -description = "{{cookiecutter.short_description}}" +description = "{{cookiecutter.project_desc}}" readme = "README.md" requires-python = ">=3.11" license = "MIT"