feat: added shepard

This commit is contained in:
Tyler Gillispie 2024-01-09 12:53:53 -08:00
parent 4807c7f497
commit 9347123018
9 changed files with 437 additions and 683 deletions

6
CHANGELOG.md Normal file
View File

@ -0,0 +1,6 @@
## 0.2.0 (2024-01-09)
* feat: added release please ([4807c7f](https://gitea/tylerg/release-please/commits/4807c7f))
* build: add commit lint w/hook ([40b7a52](https://gitea/tylerg/release-please/commits/40b7a52))

View File

@ -1,6 +1,6 @@
{
"name": "ci-logs-and-version-mgnt",
"version": "0.0.1",
"version": "0.2.0",
"description": "",
"main": "index.js",
"scripts": {
@ -12,7 +12,8 @@
"devDependencies": {
"@commitlint/cli": "^18.4.4",
"@commitlint/config-angular": "^18.4.4",
"husky": "^8.0.3",
"release-please": "^16.7.0"
"conventional-changelog-cli": "^4.1.0",
"conventional-recommended-bump": "^9.0.0",
"husky": "^8.0.3"
}
}

921
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

41
scripts/clog Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
# Conventional ChangeLog Wrapper Script: clog
function bump {
releaseType=$(npx conventional-recommended-bump -p angular)
bumpVersion=$(pnpm version $releaseType --no-git-tag-version)
echo "Release Type: $releaseType"
echo "Bump Version: $bumpVersion"
}
function log {
ret=$(npx conventional-changelog \
--preset $PRESET \
--infile ../CHANGELOG.md \
--same-file
)
echo $ret
}
function logReset {
ret=$(npx conventional-changelog \
--preset $PRESET \
--infile ../CHANGELOG.md \
--same-file \
--release-count 0
)
echo $ret
}
function logHelp {
npx conventional-changelog --help
}
# main
source ./sheep; sheep $@

49
scripts/conv-clog-lib Normal file
View File

@ -0,0 +1,49 @@
#!/bin/bash
# ConventionalChange Log Wrapper Library: conv-clog
function bump {
releaseType=$(npx conventional-recommended-bump -p angular)
bumpVersion=$(pnpm version $releaseType --no-git-tag-version)
echo "Release Type: $releaseType"
echo "Bump Version: $bumpVersion"
}
function log {
ret=$(npx conventional-changelog \
--preset $PRESET \
--infile ../CHANGELOG.md \
--same-file
)
echo $ret
}
function logReset {
ret=$(npx conventional-changelog \
--preset $PRESET \
--infile ../CHANGELOG.md \
--same-file
--release-log 0
)
echo $ret
}
function logHelp {
npx conventional-changelog --help
}
# ToDo: Not in use: release-please bootstrap calls POST on git/refs api, which gitea does not support.
function preRelBootstrap {
npx release-please bootstrap \
--token=$TOKEN \
--api-url="$GIT_URL" \
--repo-url=$OWNER/$REPO \
--release-type=$TYPE \
--dry-run
}

28
scripts/gitea Executable file
View File

@ -0,0 +1,28 @@
#!/bin/bash
# Conventional ChangeLog Wrapper Script: clog
function githubRelease {
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/OWNER/REPO/releases \
-d '{"tag_name":"v1.0.0","target_commitish":"master","name":"v1.0.0","body":"Description of the release","draft":false,"prerelease":false,"generate_release_notes":false}'
}
function release {
local tag=$1
local name=$2
local body=$3
local branch=$4
curl -L \
-X POST \
-H "Accept: application/json" \
-H "Authorization: Bearer $GIT_TOKEN" \
$SERVER/repos/$OWNER/$REPO/releases \
-d '{"tag_name":"'$tag'","target_commitish":"'$branch'","name":"'$name'","body":"'$body'","draft":false,"prerelease":false,"generate_release_notes":false}'
}
. ./sheep; sheep $@

26
scripts/release Executable file
View File

@ -0,0 +1,26 @@
#!/bin/bash
source ../.env
#source ./clog
#source ./gitea
# Development Workflow
# 1. Changes
# 2. Commit Changes
# N. ...
# 4. (Maybe Squash)
# Releae Work Flow
# 1. Bump Version
# 2. Create ChangeLog
# 3. Commit
# 4. Tag and Push Tag
# 5. Create Release
ver=$(./clog bump)
#cl=$(log)
echo -e "$ver"
#echo -e "$cl"

View File

@ -1,12 +0,0 @@
#!/bin/bash
source ../.env
npx release-please bootstrap \
--token=$TOKEN \
--api-url="$GIT_URL" \
--repo-url=$OWNER/$REPO \
--release-type=$TYPE \
--dry-run

30
scripts/sheep Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
# Sheep: Shepard a file full of functions.
# Call one directly or load them as a library.
#
function sheep {
if [[ "${BASH_SOURCE[1]}" != "${0}" ]]; then
: # Do Nothing: no-op command
else
# Run if loaded directly.
source ../.env
CALL=$1
shift
# Call Method
[[ "$(type -t $CALL)" == "function" ]] && {
"$CALL" "$@"
} || {
[[ -z "$CALL" ]] && {
echo -e "Available Functions\n"
ret="$(declare -Fp)"
ret="${ret//declare -f/}"
echo "${ret//sheep/}"
}
}
fi
}