Skip to content

Commit

Permalink
⤵️ automation(synchronize) Applying changes from upstream repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
Megabyte Labs committed Apr 7, 2022
1 parent 28f6415 commit f9e15d2
Show file tree
Hide file tree
Showing 16 changed files with 505 additions and 151 deletions.
5 changes: 3 additions & 2 deletions .config/taskfiles/ansible/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,9 @@ tasks:
- cp test/{{OS}}/ansible.cfg ansible.cfg
- touch install_in_progress
- |
.config/log info 'Prompting for sudo password which is required to run the playbook'
{{.PYTHON_HANDLE}}ansible-playbook --ask-sudo-pass{{if eq .INSTALLING 'false'}} --skip-tags "skip_on_init" playbooks/init.yml{{else}} main.yml{{end}}
.config/log info 'Prompting for sudo password and vault password which is required to run the playbook'
.config/log info 'If you do not have a vault password, just enter a blank password at the vault password prompt'
{{.PYTHON_HANDLE}}ansible-playbook --ask-sudo-pass {{.CLI_ARGS}}{{if eq .INSTALLING 'false'}} --skip-tags "skip_on_init" playbooks/init.yml{{else}} main.yml{{end}}
- if [ -f ansible.cfg.bak ]; then mv ansible.cfg.bak ansible.cfg; fi
- if [ -f inventory ]; then rm inventory; fi

Expand Down
12 changes: 4 additions & 8 deletions .config/taskfiles/common/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,13 @@ tasks:
- task: husky:install
- task: husky:permissions
status:
- '[ "{{.DOCKER_ENVIRONMENT}}" == "true" ]'
- '[ "{{.DOCKER_ENVIRONMENT}}" == "true" ] || [ "$SEMANTIC_RELEASE" == "true" ]'

husky:ci:
cmds:
- task: husky:permissions
status:
- '[ "{{.DOCKER_ENVIRONMENT}}" != "true" ]'
- '[ "{{.DOCKER_ENVIRONMENT}}" != "true" ] || [ "$SEMANTIC_RELEASE" == "true" ]'

husky:install:
deps:
Expand Down Expand Up @@ -135,13 +135,9 @@ tasks:
cmds:
- |
curl -sSL '{{.MODEL_TASKFILE}}' > '{{.MODEL_TMP}}'
TMP_BACKUP="$(mktemp)"
cp '{{.MODEL_TMP}}' "$TMP_BACKUP"
export ZXXXY="$(yq e '.' {{.MODEL_TMP}})"
yq e '. | .vars = (env(ZXXXY) | .vars) | .env = (env(ZXXXY) | .env)' Taskfile.yml > '{{.MODEL_TMP}}'
mv '{{.MODEL_TMP}}' Taskfile.yml
cp "$TMP_BACKUP" '{{.MODEL_TMP}}'
- yq eval-all -i 'select(fileIndex == 0) * select(fileIndex == 1)' '{{.MODEL_TMP}}' Taskfile.yml
yq e -i '. | .vars = (env(ZXXXY) | .vars) | .env = (env(ZXXXY) | .env)' Taskfile.yml
yq eval-all -i 'select(fileIndex == 0) * select(fileIndex == 1)' '{{.MODEL_TMP}}' Taskfile.yml
requirements:
deps:
Expand Down
35 changes: 14 additions & 21 deletions .config/taskfiles/git/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,12 @@ tasks:
log:
start: Running automated commit
cmds:
- cmd: |
if [[ "$FULLY_AUTOMATED_TASKS" == 'true' ]]; then
task --list > /dev/null || (echo "ERROR: Invalid Taskfiles!" && exit 1)
git add --all
HUSKY=0 git commit -m "☁️ Automation" -n
fi
- task --list > /dev/null || (echo "ERROR > Invalid Taskfile(s)!" && exit 1)
- git add --all
- cmd: HUSKY=0 git commit -m "☁️ automation(update) Automated update" -n
ignore_error: true
status:
- '[ "$FULLY_AUTOMATED_TASKS" != "true" ] || [ "$SEMANTIC_RELEASE" == "true" ]'

convert:folder:submodule:
deps:
Expand All @@ -72,16 +71,13 @@ tasks:
- git add --all
- git commit --quiet -m "refactor(convert-dir-to-submodule) Adding folder/project to its own git repository."
- git push --quiet -u --no-progress origin master
- |
cd ..
rm -rf {{.BASENAME}}
git add {{.BASENAME}}
git commit --quiet -m "refactor(convert-dir-to-submodule) Removing folder which will now be a submodule."
git submodule add -b master "{{.GITLAB_REPO}}" {{.BASENAME}}
git add {{.BASENAME}}
git commit --quiet -m "refactor(convert-dir-to-submodule) Adding new submodule which was previously a directory."
git push --quiet -u --no-progress origin HEAD
- .config/log success ''
- cd .. && rm -rf {{.BASENAME}}
- cd .. && git add {{.BASENAME}}
- cd .. && git commit --quiet -m "refactor(convert-dir-to-submodule) Removing folder which will now be a submodule."
- cd .. && git submodule add -b master "{{.GITLAB_REPO}}" {{.BASENAME}}
- cd .. && git add {{.BASENAME}}
- cd .. && git commit --quiet -m "refactor(convert-dir-to-submodule) Adding new submodule which was previously a directory."
- cd .. && git push --quiet -u --no-progress origin HEAD
preconditions:
- sh: '[[ ! $(git rev-parse --git-dir) =~ ".git/modules" ]]'
msg: Cannot convert the directory to a submodule - the directory already appears to be a submodule.
Expand Down Expand Up @@ -123,12 +119,9 @@ tasks:
start: Running `git push all master --force || git push origin master`
success: Successfully ran `git push all master --force || git push origin master`
cmds:
- |
if [[ "$FULLY_AUTOMATED_TASKS" == 'true' ]]; then
git push all master --force || git push origin master
fi
- git push all master --force || git push origin master
status:
- '[ -n "$CI" ]'
- '[ -n "$CI" ] || [ "$SEMANTIC_RELEASE" == "true" ] || [ "$FULLY_AUTOMATED_TASKS" != "true" ]'

remotes:
deps:
Expand Down
4 changes: 2 additions & 2 deletions .config/taskfiles/go/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ tasks:

prepare:
cmds:
- task: :go:goreleaser:publish
- task: :go:goreleaser:build

publish:
cmds:
- 'true'
- task: :go:goreleaser:publish

test:
deps:
Expand Down
3 changes: 3 additions & 0 deletions .config/taskfiles/install/Taskfile-github.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ tasks:
echo '{{.BIN}}' >> local/slim/exe.txt
echo '{{.INSTALL_TASK}}' >> local/slim/install.txt
fi
env:
PATH:
sh: echo "$PATH:$HOME/.local/go/bin"
run: when_changed
log:
error: Failed to acquire GitHub release from `{{.PACKAGE}}`
Expand Down
2 changes: 1 addition & 1 deletion .config/taskfiles/install/Taskfile-pipx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ tasks:
- task: :install:software:pipx
- |
if [ -n "$CI" ]; then echo "*************** pipx --> {{.PACKAGE}}"; fi
- pipx install {{.PACKAGE}}
- pipx install {{.PACKAGE}} --include-deps
status:
- type {{.BIN}} > /dev/null

Expand Down
1 change: 1 addition & 0 deletions .config/taskfiles/install/Taskfile-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tasks:
run: once
cmds:
- task: :install:software:python
- task: :{{if eq .REPOSITORY_TYPE "ansible"}}install:pipx:ansible{{else}}donothing{{end}}
- task: requirements:poetry
- task: :{{if eq .REPOSITORY_TYPE "ansible"}}ansible:galaxy:requirements{{else}}donothing{{end}}

Expand Down
2 changes: 2 additions & 0 deletions .config/taskfiles/install/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ tasks:
- pnpm-lock.yaml

modules:local:sync:
deps:
- modules:local
log:
error: Error while synchronizing `NPM_KEEP_UPDATED` packages with the latest version(s)
start: Ensuring `NPM_KEEP_UPDATED` NPM packages are the latest version
Expand Down
12 changes: 11 additions & 1 deletion .config/taskfiles/npm/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,17 @@ tasks:
cmds:
- node-prune

publish: 'true'
publish:
vars:
REGISTRY_ADDRESS:
sh: jq -r '.publishConfig["@megabyte:registry"]' package.json
summary: |
Following shows how to configure to publish to GitLab if needed in future:
npm config set -- '{{.REGISTRY_ADDRESS}}:_authToken' '${GITLAB_TOKEN}'
npm publish
cmds:
- 'true'

start:
deps:
Expand Down
3 changes: 2 additions & 1 deletion .config/taskfiles/publish/Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ tasks:
sh: if [ -f setup.cfg ]; then echo 'poetry run '; else echo ''; fi
RUN_OPTIONS: '{{if .CLI_ARGS}} {{.CLI_ARGS}}{{else}} --ci false --debug --dry-run false{{end}}'
env:
HUSKY: '0'
PUBLISHING: 'true'
SEMANTIC_RELEASE: 'true'
log:
error: Error while running `semantic-release`
start: Releasing with `semantic-release`..
Expand All @@ -68,7 +70,6 @@ tasks:
if [ -n "$CI" ]; then
export GIT_CREDENTIALS="gitlab-ci-token:$CI_BUILD_TOKEN"
fi
unset
{{.RELEASE_PREFIX}}semantic-release -r "$(git remote get-url origin)"{{.RUN_OPTIONS}}
version:tag:
Expand Down
Loading

0 comments on commit f9e15d2

Please sign in to comment.