Skip to content
/ template Public template

This basis for all other @kyaulabs repositories.

License

Notifications You must be signed in to change notification settings

kyaulabs/template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

8 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐Ÿ“˜ template

https://kyaulabs.com/

Contributor Covenant ย  Conventional Commits ย  GitHub ย  Gitleaks
Semantic Versioning ย  Discord

About

This repository is the basis for all other repositories created here at KYAU Labs.

  • GitHub limits repositories to 10GB of cache space for actions.
  • GitHub limits users/organizations to 0.5GB of artifact storage.

Keep these factors in mind when setting up repositories.

Install Additions (optional)

๐Ÿšง WARNING
# This is only required if you do not already have commitlint and git-cliff installed.

Install commitlint and git-cliff globally and then generate a commitlint config file.

npm i -g @commitlint/config-conventional @commitlint/cli git-cliff

New Repository

Base the repository off of the organization template repository.

Clone

git clone https://github.com/kyaulabs/template <REPOSITORY_NAME>
cd <REPOSITORY_NAME>
rm -rf .git

Init

Initialize your new repository.

git init

Add LICENSE

Add in a LICENSE of choice, using the filename LICENSE.txt, LICENSE.md or LICENSE.rst. There are two main repositories of licenses to choose from:

Add .gitignore

Add a .gitignore template from @github/gitignore (modification required).

Update README.md

Take this time to update the README.md with at least basic repository information and a hopeful table of contents. It is okay if most sections are blank.

Update cliff.toml

Be sure to modify cliff.toml and replace all the instances of kyaulabs/template with the new repository location.

Add Actions

Make sure you add the appropriate actions from the @kyaulabs/template-workflows repository.

Edit the workflow accordingly as all workflows come with only manual activation set with automatic activation commented out.

on:
  workflow_dispatch: {}
#on:
#  push:
#    branches: [ "main", "develop" ]
#  workflow_dispatch:

Git Hooks

Configuration

Generate a config for commitlint.

echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js

Symlinks

Copy or symlink to the hooks located inside of .github/hooks.

chmod u+x .github/hook/*
cp .github/hooks/* .git/hooks/

Initial Commit

Stage All

Add all files to the repository. The first command utilizing the dry-run switch to make sure you do not need any last minute additions to .gitignore.

git add -A -n
git add -A

Commit

Push the initial commit with (non-commitlint verified message).

git commit -S -a -m "ignore: here be dragons"

Finally set the main branch name.

git branch -M main

Push

Add the remote origin and push the branch to origin.

git remote add origin [email protected]:kyaulabs/<REPOSITORY_NAME>.git
git push -u origin main

Repository Settings

In order to have proper repository security, some settings need to change. Open up the repository settings by clicking on the Settings tab at the top of the repository.

General

Upload an image to customize the repositoryโ€™s social media preview.

Under the Features section enable Sponsorships and then disable anything that is not being using.

Collaborators and Teams

Under manage access click on Add people. In the search box enter and select @kyaulabs-bot then change the role to Write.

@kyaulabs-bot

Branches

Create a new branch protection rule by clicking Add branch protection rule.

  • Branch name pattern: main
  • Protect matching branches:
    • Require a pull request before merging
    • Require approvals (1)
    • Require signed commits

Click Create.

Create another branch protection rule with the following:

  • Branch name pattern: **/**
  • Protect matching branches:
    • Require signed commits

Webhooks

If you would like this repository to output to a channel on Discord you will need to create a webhook on both ends.

In Discord goto the Server Settings > Apps > Integrations and click New Webhook. Give it an avatar, name and select a channel for it to output to.

Back on GitHub on the Settings > Webhooks page, create a new hook by clicking Add webhook.

  • Payload URL: Click on Copy Webhook URL in Discord to get this URL.
  • Content type: application/json
  • Let me select individual events:
    • Commit comments Forks Issues Page builds Pull requests Pushes Releases Statuses Wiki

Click on Add webhook.

Issue Labels

Organization level issue labels work in conjunction with conventional commits. We use a modified version of the TIPS system called TPS or Type, Priority and Status as a way to label issues such that they can be organized and assigned accordingly.

In order to properly label something be sure to include at least one type, a single priority and it's current status. Optional labels may be added at your discretion.

T - Type: Directly corresponds to the conventional commits type.

Group Label Color Description
Type feature #41d6c3 ๐Ÿš€ Feature
Type patch #41d6c3 ๐Ÿš€ Sub-Feature
Type bug #ff5050 ๐Ÿ› Bug
Type documentation #c0e6ff ๐Ÿ“ Documentation
Type performance #41d6c3 โšก๏ธ Performance
Type refactor #ffa572 โ™ป๏ธ Refactor
Type style #ffa572 ๐Ÿ’„ Styling
Type test #ffd791 โš—๏ธ Testing
Type ci/cd #ffd791 ๐Ÿ‘ท CI/CD
Type chore #ffd791 ๐Ÿ”ฎ Misc
Type security #ff5050 ๐Ÿ”’๏ธ Security

P - Priority: The urgency of the issue/task.

Group Label Color Description
Priority critical #800000 Security-related/Project-breaking
Priority high #c11c00 Foundational / Important
Priority medium #f39a4d Basic / Normal
Priority low #8cd211 Additional / Polish

S - Status: Current progress.

Group Label Color Description
Status done #0e8a16 Complete
Status in progress #fbca04 Currently Working On
Status testing #fbca04 Testing Ideas / Methods
Status under construction #fbca04 Beginning Stages

Optional: Two other groups are included for convinience.

Group Label Color Description
Feedback brainstorming #db2780 Coming Up w/ New <Type>
Feedback help wanted #db2780 Help Requested on <Type>
Feedback research #db2780 <Type> Needs Research
Feedback request for comments #db2780 External Opinions Needed on <Type>
Other good first issue #4e3cb2 Good Issue for First Time Contributor
Other duplicate #cfd3d7 Duplicate <Type>
Other invalid #cfd3d7 Invalid <Type>
Other on hold #cfd3d7 Currently On Hold
Other won't fix #cfd3d7 This Will Not Be Fixed

Conventional Commits

In order to abide by the conventional commit guidelines and in return get auto-generated changelogs, use the following.

<type>[optional scope]: <subject>

[optional body]

[optional footer(s)]

Type

[required] (!empty) value = {
  'build',
  'chore',
  'ci',
  'docs',
  'feat',   # this correlates with MINOR in Semantic Versioning
  'fix',    # this correlates with PATCH in Semantic Versioning
  'patch',  # this correlates with PATCH in Semantic Versioning
  'perf',
  'refactor',
  'revert',
  'style',
  'test',
  'ignore'  # this correlates with CHANGELOG ignores
}

A trailing ! indicates a BREAKING CHANGE (correlating with MAJOR in Semantic Versioning).

Scope

[optional] {lowercase | camelCase}

A noun describing a section of the codebase surrounded by parenthesis.

Subject

[required] (!empty) {lowercase | camelCase} (max-length: 100)

A short summary of the code changes, without a trailing full-stop.

Adding [skip ci] will skip all push and pull_request workflows.

Body

[optional] {freeform} (max-length: 100)

Longer commit body with additional contextual information about the code changes.

Footer

<token>: <value>
[optional] (max-length: 100)
token (Sentance-case) = {
  'BREAKING CHANGE',    # Exception to the rule
  'Acked-by',
  'Cc',
  'Fixes',
  'Helped-by',
  'Refs',
  'Reviewed-by',
  'Signed-off-by',
}

Any number of tokens may be included.

Examples

The following are all examples of valid commit messages.

The commit message will also go through validation with commitlint upon issuing git commit.

feat(player): begin new implementation of input controller

As per #123 recommendation input contoller is now based on blah.

Basic movement added.

Acked-by: Alice <[email protected]>
Signed-off-by: Bob <[email protected]>
Refs: #123
Refs: 676104e, a215868
fix: array parsing issue

Fixes: #42
Cc: Z
Reviewed-by: Z
Signed-off-by: Z
chore(release): v0.0.1 [skip ci]

Changelog

Once you have published at least one proper commit using conventional commits syntax you will be able to generate a changelog.

git cliff --tag 0.0.1

After the initial run of git-cliff all subsequent runs should detect the version automatically.

git cliff

A typical workflow should look like the following.

git add -A                      # add all un-indexed and changed files to the commit
git commit -S -a -m "<message>" # add a conventional commit message and sign the commit
git cliff                       # generate a new changelog
git add CHANGELOG.md            # add the changelog file to the commit
git commit --amend --no-edit    # ammend the added file to the previous un-pushed commit
git push -u origin develop      # finally, push the commit

Unity Projects

Unity Activation

Visit the repository page and navigate to Actions. Manually run the Unity Activation ๐Ÿ” action and then download the artifact.

Extract the zip file somewhere accessible.

Visit license.unity3d.com and upload the Unity_v20XX.X.XXXX.alf file, receiving a license file Unity_v20XX.X.ulf in return.

Navigate on Github to Settings > Secrets and variables > Actions.

Create the following repository secrets:

  • UNITY_LICENSE - (Copy the contents of your license file into here)
  • UNITY_EMAIL - (Add the email address that you use to login to Unity)
  • UNITY_PASSWORD - (Add the password that you use to login to Unity)

Attribution