Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
emmeowzing authored Jan 18, 2025
0 parents commit 7147429
Show file tree
Hide file tree
Showing 11 changed files with 897 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .circleci/app.ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
README.md
LICENSE
renovate.json
.pre-commit-config.yaml
.github/
133 changes: 133 additions & 0 deletions .circleci/app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
version: 2.1

executors:
default:
docker:
- image: cimg/base:stable

commands:
increment-minor-tag:
steps:
- run:
name: Autoincrement repository's latest tag minor version
command: |+
git fetch --all --tags
RES="$(git show-ref --tags)"
if [ -z "$RES" ]; then
NEW_TAG="v1.0.0"
else
mapfile -d " " -t LATEST_TAG < <(git tag | sort -V | tail -1 | sed 's/\./ /g')
if [ "${#LATEST_TAG[@]}" -ne 3 ]; then
printf "Must follow semver convention /v?[0-9]{3}.[0-9]{3}.[0-9]{3}/ to parse.\\n" 1>&2
exit 1
fi
one="${LATEST_TAG[0]//v/}"
two="${LATEST_TAG[1]}"
three="${LATEST_TAG[2]}"
# Increment versions mod 1k.
if [ "$three" == "999" ]; then
if [ "$two" == "999" ]; then
three=0
two=0
((one++))
else
((two++))
three=0
fi
elif [ "$two" == "999" ] && [ "$three" == "999" ]; then
((one++))
two=0
else
((three++))
fi
NEW_TAG="v${one}.${two}.${three}"
fi
git tag "$NEW_TAG"
git push origin "$NEW_TAG"
release:
steps:
- run:
name: Generate release
command: |+
# Get latest tag.
git fetch --all --tags
export LATEST_TAG="$(git tag | sort -V | tail -1)"
echo "$LATEST_TAG"
# Generate release from tag.
echo "$GITHUB_TOKEN" | gh auth login --with-token 2>/dev/null || true
gh release create "$LATEST_TAG" --generate-notes
jobs:
autoincrement-minor-tag:
executor: default
resource_class: small
steps:
- checkout
- add_ssh_keys:
fingerprints:
- FIXME
- increment-minor-tag

generate-release:
executor: default
resource_class: small
steps:
- checkout
- run:
name: Install gh CLI
command: |+
wget https://github.com/cli/cli/releases/download/v2.9.0/gh_2.9.0_linux_amd64.deb -O gh.deb
sudo dpkg -i gh.deb
- release

hello:
executor: default
resource_class: small
steps:
- run:
name: Hello
command: echo hello

workflows:
version: 2

on-tag:
jobs:
- hello:
filters:
branches:
ignore: /.*/
tags:
only: /^v[0-9]+\.[0-9]+\.[0-9]+$/

on-merge:
jobs:
# Auto-increment minor tag to kick off on-tag workflow.
- autoincrement-minor-tag:
filters:
branches:
only: master

# Generate a release from the latest tag.
- generate-release:
context: github
filters:
branches:
only: master
requires:
- autoincrement-minor-tag

on-commit:
jobs:
- hello:
filters:
branches:
ignore: master
17 changes: 17 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2.1

setup: true

orbs:
dynamic: bjd2385/[email protected]

workflows:
version: 2

default:
jobs:
- dynamic/extend:
context: orb-publishing
modules: |
.
scripts
21 changes: 21 additions & 0 deletions .circleci/scripts.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: 2.1

orbs:
shellcheck: circleci/[email protected]

executors:
default:
docker:
- image: cimg/base:stable

workflows:
version: 2

on-commit:
jobs:
- shellcheck/check:
dir: ./src/scripts
exclude: SC2148
filters:
branches:
ignore: master
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

ko_fi: bjd2385
10 changes: 10 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
_extends: .github

repository:
name: base
description: Base repository with default settings and configs
homepage: github.com

# A comma-separated list of topics to set on the repository
topics: settings
private: false
23 changes: 23 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
hooks:
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict

- repo: https://github.com/bjd2385/circleci-orb-pre-commit-hook
rev: v1.2.0
hooks:
- id: circleci-orb-validate
args:
- src # Target the src/ directory.
- "true" # Enable pre-pack prior to validation.

- repo: https://github.com/bjd2385/circleci-config-pre-commit-hook
rev: v1.0.3
hooks:
- id: circleci-config-validate
Loading

0 comments on commit 7147429

Please sign in to comment.