Skip to content

Commit

Permalink
☁️ chore(automation): Automated update
Browse files Browse the repository at this point in the history
  • Loading branch information
ProfessorManhattan committed Apr 23, 2022
1 parent 03fcc1c commit 38e2fa6
Show file tree
Hide file tree
Showing 125 changed files with 964 additions and 359 deletions.
11 changes: 10 additions & 1 deletion .config/common-keywords.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
{
"keywords": ["installdoc", "installdoctor", "mblabs", "megabytelabs", "professormanhattan"]
"keywords": [
"files",
"mblabs",
"megabytelabs",
"miscellaneous",
"other",
"professormanhattan",
"supporting",
"washingtondc"
]
}
22 changes: 0 additions & 22 deletions .config/dockerignore

This file was deleted.

3 changes: 2 additions & 1 deletion .config/taskfiles/ansible/Taskfile-ansibler.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ tasks:
start: Populating the supported platforms listed in `meta/main.yml` based on the compatibility chart data
success: Successfully populated `meta/main.yml` platforms
cmds:
- '{{.PYTHON_HANDLE}}ansibler --populate-platforms --json-file .cache/compatibility-chart.json'
- cmd: '{{.PYTHON_HANDLE}}ansibler --populate-platforms --json-file .cache/compatibility-chart.json'
ignore_error: true
sources:
- .cache/compatibility-chart.json
- meta/main.yml
Expand Down
40 changes: 40 additions & 0 deletions .config/taskfiles/ansible/Taskfile-playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,43 @@ tasks:
BASENAME="$(basename {{.CLI_ARGS}})"
REMOTE="$(git remote get-url $BASENAME)"
HUSKY=0 git subrepo init {{.CLI_ARGS}} -r "$REMOTE" -b master
types:
deps:
- :install:npm:quicktype
summary: |
# Generate Types from Vaulted Files
Automatically generate types from vaulted files.
**Example Usage:**
`task ansible:playbook:types -- ./environments/prod
vars:
TARGET_DIR: '{{if .CLI_ARGS}}{{.CLI_ARGS}}{{else}}./environments/prod{{end}}'
cmds:
- task: vault:decrypt
vars:
TARGET_DIR: '{{.TARGET_DIR}}'
- |
qtype() {
local FILE_NO_EXT="$(echo "$1" | sed 's/.yml$//')"
yq e -o=json '.' $1 | quicktype -l schema -o ${FILE_NO_EXT}.schema.json
}
while read FILE; do
qtype "$FILE"
done < <(find {{.TARGET_DIR}} -type f -name "*vault.yml")
- task: vault:encrypt
vars:
TARGET_DIR: '{{.TARGET_DIR}}'

vault:decrypt:
vars:
TARGET_DIR: '{{if .CLI_ARGS}}{{.CLI_ARGS}}{{else}}./environments/prod{{end}}'
cmds:
- find {{.TARGET_DIR}} -type f -name "*vault.yml" -printf "%h/\"%f\" " | xargs ansible-vault decrypt

vault:encrypt:
vars:
TARGET_DIR: '{{if .CLI_ARGS}}{{.CLI_ARGS}}{{else}}./environments/prod{{end}}'
cmds:
- find {{.TARGET_DIR}} -type f -name "*vault.yml" -printf "%h/\"%f\" " | xargs ansible-vault encrypt
22 changes: 2 additions & 20 deletions .config/taskfiles/common/Taskfile-start.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ vars:
sh: mktemp

env:
AUTO_COMMIT_MESSAGE: 'false'
PREPARE_PROJECT: 'true'
UPDATE_GIT_REPOS: 'true'

Expand All @@ -25,26 +24,9 @@ tasks:
commit:
run: once
cmds:
- task: commit:auto
- task: commit:manual
status:
- '[ -z "$AUTO_COMMIT" ]'

commit:auto:
run: once
cmds:
- task: :commit:quick
- task: :ci:synchronize
status:
- '[ "$AUTO_COMMIT_MESSAGE" != "true" ]'

commit:manual:
run: once
cmds:
- task: :commit:all
- task: :git:commit:automated
- task: :git:push:all
- task: :ci:synchronize
status:
- '[ "$AUTO_COMMIT_MESSAGE" == "true" ]'

dev:
cmds:
Expand Down
57 changes: 44 additions & 13 deletions .config/taskfiles/common/Taskfile-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,21 +65,24 @@ tasks:
msg: '`@appnest/readme` is not installed globally.'

files:
vars:
CONTAINER:
sh: if [ "{{.DOCKER_ENVIRONMENT}}" == "true" ]; then echo "docker"; fi
FIRST_LINE:
sh: if [ -f Dockerfile ]; then head -n 1 Dockerfile; fi
deps:
- files:ansible:keywords:sync
- files:dockerignore
- files:docs
- files:go:dummy
- files:husky
- files:initctl
log:
error: Encountered error while updating miscellaneous files
start: Updating miscellaneous files
success: Updated miscellaneous files

files:ansible:keywords:sync:
cmds:
- task: :{{if eq .REPOSITORY_SUBTYPE "role"}}ansible:keywords:sync{{else}}donothing{{end}}

files:dockerignore:
cmds:
- |
if [ -f initctl ] && [ -f .config/initctl ]; then
cp .config/initctl initctl
.config/log info 'Ensured that the `initctl` polyfill file is synchronized with the upstream version'
fi
- |
if [ -f .dockerignore ]; then
TMP="$(mktemp)"
Expand All @@ -97,8 +100,33 @@ tasks:
rm .config/dockerignore
fi
fi
files:docs:
cmds:
- mkdir -p docs/partials && echo '<!-- Add content in this file to include it in automatically generated README.md -->' > docs/partials/guide.md
status:
- '[ -f docs/partials/guide.md ]'

files:go:dummy:
cmds:
- echo -e 'package main\n\nfunc main() {\n}\n' > .config/dummy.go
status:
- '[ "{{.REPOSITORY_SUBTYPE}}" != "cli" ] || [ "{{.REPOSITORY_TYPE}}" == "go" ]'

files:husky:
vars:
CONTAINER:
sh: if [ "{{.DOCKER_ENVIRONMENT}}" == "true" ]; then echo "docker"; fi
cmds:
- task: :common:{{if eq .CONTAINER "docker"}}husky:ci{{else}}husky{{end}}
- task: :{{if eq .REPOSITORY_SUBTYPE "role"}}ansible:keywords:sync{{else}}donothing{{end}}

files:initctl:
cmds:
- |
if [ -f initctl ] && [ -f .config/initctl ]; then
cp .config/initctl initctl
.config/log info 'Ensured that the `initctl` polyfill file is synchronized with the upstream version'
fi
finish:
cmds:
Expand Down Expand Up @@ -187,8 +215,8 @@ tasks:
git reset --hard HEAD
git checkout "$DEFAULT_BRANCH"
git pull origin "$DEFAULT_BRANCH" --ff-only || true
cd "$ROOT_DIR"
done
cd "$ROOT_DIR"
.config/log success 'Ensured submodules in the `.modules` folder are pointing to the master branch'
fi
status:
Expand Down Expand Up @@ -266,7 +294,10 @@ tasks:
cmds:
- task: start
- task: all
- task: ':{{if eq .REPOSITORY_TYPE "docker"}}docker:update:labels{{else}}donothing{{end}}'
- |
if [ -f Dockerfile ]; then
task {{if eq .REPOSITORY_TYPE "docker"}}docker:update:labels{{else}}donothing{{end}}
fi
upstream:remotes:
deps:
Expand Down
4 changes: 2 additions & 2 deletions .config/taskfiles/common/Taskfile-util.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ tasks:
TMP_JQ="$(mktemp)"
TMP_YQ="$(mktemp)"
mkdir -p "$(dirname '{{.MAP_FILE}}')"
yq -o=j '{{.MAP_FILE_QUERY}}' Taskfile.yml > "{{.MAP_FILE}}"
yq e -o=j '{{.MAP_FILE_QUERY}}' Taskfile.yml > "{{.MAP_FILE}}"
jq -c '.[]' "{{.MAP_FILE}}" | while read i; do
PREFIX="$(echo "$i" | jq -r '.key')"
FILE="$(echo "$i" | jq -r '.value')"
if [ -f "$FILE" ]; then
yq -o=j '.tasks' "$FILE" > "$TMP_YQ"
yq e -o=j '.tasks' "$FILE" > "$TMP_YQ"
jq --arg prefix "$PREFIX:" '[to_entries | .[] | .key as $key | .value | ._task? = $prefix + $key]' "$TMP_YQ" > "$TMP_JQ"
jq -s '.[0] + .[1]' "$COMBINED" "$TMP_JQ" > "$TMP_COMBINED"
cp "$TMP_COMBINED" "$COMBINED"
Expand Down
12 changes: 9 additions & 3 deletions .config/taskfiles/fix/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,9 @@ tasks:
python:
deps:
- :install:pipx:black
- :install:pipx:add-trailing-comma
- :install:pipx:isort
- :install:pipx:pyformat
desc: Automatically format Python files using Black
hide: '{{ne .REPOSITORY_TYPE "python"}}'
summary: |
Expand All @@ -309,10 +311,14 @@ tasks:
cmds:
- |
{{if .CLI_ARGS}}
black {{.CLI_ARGS}}
pyformat -i {{.CLI_ARGS}}
isort --overwrite-in-place {{.CLI_ARGS}}
add-trailing-comma --exit-zero-even-if-changed {{.CLI_ARGS}}
{{else}}
while read PATHH; do
black "$PATHH"
pyformat -i "$PATHH"
isort --overwrite-in-place "$PATHH"
add-trailing-comma --exit-zero-even-if-changed "$PATHH"
done < <(find . -type d \( {{.IGNORE_FOLDERS}} \) -prune -o -type f \( -name '*.py' \))
{{end}}
Expand Down
2 changes: 1 addition & 1 deletion .config/taskfiles/git/Taskfile-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tasks:
start: Checking for presence of GitHub repository and creating one if it does not exist
success: Ensure GitHub repository is present
cmds:
- cmd: gh repo create "{{.GITHUB_SLUG}}" --enable-wiki={{.GITHUB_WIKI}} -y --description "{{.EMOJI_START}}{{.DESCRIPTION}}{{.EMOJI_END}}"
- cmd: gh repo create "{{.GITHUB_ORG}}/{{.GITHUB_SLUG}}" --enable-wiki={{.GITHUB_WIKI}} -y --description "{{.EMOJI_START}}{{.DESCRIPTION}}{{.EMOJI_END}}"
--homepage "{{.HOMEPAGE}}" {{.PROJECT_TYPE}} > /dev/null
ignore_error: true
- |
Expand Down
6 changes: 4 additions & 2 deletions .config/taskfiles/git/Taskfile-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ tasks:
- '[ -z "$GITHUB_TOKEN" ]'

exportall:gitlab:
env:
vars:
GITLAB_PATH:
sh: jq -r '.blueprint.repository.gitlab' package.json | sed 's/https:\/\/gitlab.com\///' | sed 's/\/[^\/]*$//' | sed 's/\//%2F/g'
GITLAB_SLUG:
sh: jq -r '.blueprint.repository.gitlab' package.json | sed 's/.*\/\([^\/]*\)$/\1/'
env:
GL_CURL_AUTH:
sh: |
echo "PRIVATE-TOKEN: $GITLAB_TOKEN"
Expand Down Expand Up @@ -53,11 +54,12 @@ tasks:
- '[ -z "$GITHUB_TOKEN" ]'

import:gitlab:
env:
vars:
GITLAB_PATH:
sh: jq -r '.blueprint.repository.gitlab' package.json | sed 's/https:\/\/gitlab.com\///' | sed 's/\/[^\/]*$//' | sed 's/\//%2F/g'
GITLAB_SLUG:
sh: jq -r '.blueprint.repository.gitlab' package.json | sed 's/.*\/\([^\/]*\)$/\1/'
env:
GL_CURL_AUTH:
sh: |
echo "PRIVATE-TOKEN: $GITLAB_TOKEN"
Expand Down
2 changes: 2 additions & 0 deletions .config/taskfiles/git/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ tasks:
push:all:
deps:
- :ci:commit:config
- :git:github:create
- :git:gitlab:create
log:
error: Encountered error while running `git push all master --force || git push origin master`
start: Running `git push all master --force || git push origin master`
Expand Down
11 changes: 11 additions & 0 deletions .config/taskfiles/image/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,17 @@ tasks:
sources:
- '**/*.(jpg|png)'

convert:logo:
deps:
- :install:npm:sharp
- :install:npm:tinypng
cmds:
- sharp -i {{.CLI_ARGS}} -f png -o logo.png resize 200 200
- tinypng -k "{{.TINYPNG_API_KEY}}" logo.png
- .config/log info 'Generated `logo.png`'
- rm -f {{.CLI_ARGS}}
- .config/log info 'Ensured `{{.CLI_ARGS}}` is removed'

resize:
deps:
- :install:npm:sharp
Expand Down
15 changes: 15 additions & 0 deletions .config/taskfiles/install/Taskfile-gh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ tasks:
BIN_NAME: mkcert
PACKAGE: FiloSottile/mkcert

nfpm:
cmds:
- task: install:gh
vars:
BIN_NAME: nfpm
PACKAGE: goreleaser/nfpm

oq:
cmds:
- task: install:gh
Expand Down Expand Up @@ -254,6 +261,14 @@ tasks:
cmds:
- .config/log warn '`up` is not available for Windows from GitHub Releases'

ventoy:
cmds:
- gh release download -R ventoy/Ventoy -p "*linux.tar.gz"
- mkdir -p ./bin && mv ./ventoy-*/VentoyGUI.x86_64 ./bin/ventoy
- chmod +x ./bin/ventoy
status:
- '[ -f ./bin/ventoy ]'

yq:
cmds:
- task: install:gh
Expand Down
19 changes: 18 additions & 1 deletion .config/taskfiles/install/Taskfile-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ tasks:
vars:
PACKAGE: husky

ifttt:
run: once
cmds:
- task: install:npm
vars:
BIN_NAME: ifttt
PACKAGE: ifttt-cli

install:npm:
vars:
BIN: '{{if .BIN_NAME}}{{.BIN_NAME}}{{else}}{{.PACKAGE}}{{end}}'
Expand Down Expand Up @@ -391,6 +399,15 @@ tasks:
vars:
PACKAGE: prettier

quicktype:
run: once
tags:
- update
cmds:
- task: install:npm
vars:
PACKAGE: quicktype

readme:
run: once
tags:
Expand All @@ -399,8 +416,8 @@ tasks:
- task: install:npm
vars:
BIN_NAME: readme

PACKAGE: '@appnest/readme'

remark:
run: once
tags:
Expand Down
Loading

0 comments on commit 38e2fa6

Please sign in to comment.