Skip to content

Commit d2d8470

Browse files
committed
migrate tasks to bash
1 parent 6eaa045 commit d2d8470

3 files changed

Lines changed: 41 additions & 8 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ jobs:
2424
git config --global user.name "GitHub Action"
2525
git config --global user.email "action@github.com"
2626
git config --global init.defaultBranch rendered
27-
git init build/
2827
copier -f -d docker=True -d docs=True . build/ && cd build/
2928
poetry run task lint
3029
- name: Push rendered project

copier.yaml

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,4 @@ _envops:
5050
variable_start_string: "{{"
5151
variable_end_string: "}}"
5252
_tasks:
53-
# Initialize poetry and git
54-
- git log 2>&1 > /dev/null || poetry lock -q
55-
- git log 2>&1 > /dev/null || poetry show --tree | grep '^\w' | awk '{ print $1 }' | sed 's/$/@latest/' | xargs poetry add -Dq
56-
- git log 2>&1 > /dev/null || git init
57-
- git log 2>&1 > /dev/null || git add --all
58-
- git log 2>&1 > /dev/null || git commit -qm 'initial commit'
59-
- printf "To create your repo:\n\tgh repo create -y {{repo_username}}/{{repo_name}} {% if private %}--private{% else %}--public{% endif %}"
53+
- bash postgenerate.sh

src/postgenerate.sh.jinja

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/usr/bin/env bash
2+
3+
set -euo pipefail
4+
[ -n "${DEBUG:-}" ] && set -x
5+
6+
GREEN="$(tput setaf 2 2>/dev/null || printf '')"
7+
RESET="$(tput sgr0 2>/dev/null || printf '')"
8+
9+
# If already initialized, abort
10+
if [ -d .git ] || [ -n "${COPIER_SKIP_TASKS:-}" ]; then
11+
exit 0
12+
fi
13+
14+
# Delete this script
15+
rm -- "$0"
16+
17+
echo -n "Resolving deps..."
18+
poetry lock -q
19+
poetry show --tree | grep '^\w' | awk '{ print $1 }' | sed 's/$/@latest/' | xargs poetry add -q -D --lock >/dev/null
20+
echo -e " ${GREEN}${RESET}"
21+
22+
echo -n "Installing deps..."
23+
poetry install >/dev/null
24+
echo -e " ${GREEN}${RESET}"
25+
26+
echo -n "Initializing git..."
27+
git init -q
28+
git add --all
29+
git commit -qm 'initial commit'
30+
echo -e " ${GREEN}${RESET}"
31+
32+
cat <<EOF
33+
Done!
34+
35+
To create your repo:
36+
$ gh repo create -y {{repo_username}}/{{repo_name}} {% if private %}--private{% else %}--public{% endif %}
37+
38+
To create your PAT:
39+
$ gh secret set GITHUB_PAT -b \$GITHUB_TOKEN
40+
EOF

0 commit comments

Comments
 (0)