This repository has been archived by the owner on Dec 6, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (73 loc) · 4.6 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
.PHONY: build
SHELL := /bin/bash
default:
@read -p "📦 Package manager that you're going to use. Can be "npm" or "yarn" (yarn): " pm_cli; \
if [[ -z "$$pm_cli" ]] ; then pm_cli="yarn"; else pm_cli="npm"; fi; \
export PM_CLI=$$pm_cli; \
if [[ "$$pm_cli" = "yarn" ]] ; then pm_cli_install_script="yarn install --ignore-scripts"; else pm_cli_install_script="npm install"; fi; \
export PM_CLI_INSTALL_SCRIPT=$$pm_cli_install_script; \
if [[ "$$pm_cli" = "yarn" ]] ; then pm_lock_file='yarn.lock'; else pm_lock_file="package-lock.json"; fi; \
export PM_LOCK_FILE=$$pm_lock_file; \
read -p "💡 Project title: " repo_title; \
export REPO_TITLE=$$repo_title; \
read -p "🧠 Repository owner ($$(git config user.name)): " repo_owner; \
[ -z "$$repo_owner" ] && repo_owner=$$(git config user.name); \
export REPO_OWNER=$$repo_owner; \
read -p "📝 Project owner's display name ($$(git config user.name)): " repo_owner_display_name; \
[ -z "$$repo_owner_display_name" ] && repo_owner_display_name=$$(git config user.name); \
export REPO_OWNER_DISPLAY_NAME=$$repo_owner_display_name; \
read -p "📃 Project name ($$(basename `git rev-parse --show-toplevel`)): " repo_name; \
[ -z "$$repo_name" ] && repo_name=$$(basename `git rev-parse --show-toplevel`); \
export REPO_NAME=$$repo_name; \
read -p "📈 CodeClimate maintainability badge (leave empty if you do not have it): " cc_maintainability_badge; \
if [[ -z "$$cc_maintainability_badge" ]] ; then cc_maintainability_badge=''; else cc_maintainability_badge="$$cc_maintainability_badge "; fi; \
export CC_MAINTAINABILITY_BADGE=$$cc_maintainability_badge; \
read -p "📊 CodeClimate test coverage badge (leave empty if you do not have it): " cc_test_coverage_badge; \
if [[ -z "$$cc_test_coverage_badge" ]] ; then cc_test_coverage_badge=''; else cc_test_coverage_badge="$$cc_test_coverage_badge "; fi; \
export CC_TESTS_COVERAGE_BADGE=$$cc_test_coverage_badge; \
read -p "🔧 Name of a tool that you want to setup using this GitHub Action: " tool_name; \
[ -z "$$tool_name" ] && echo '❌ CLI name cannot be empty.' && exit 1; \
export TOOL_NAME=$$tool_name; \
read -p "🗄 File extension that this GitHub Action will download to install. Supported extensions: zip, tar, xar and 7z (zip): " cli_extension; \
[ -z "$$cli_extension" ] && cli_extension='zip'; \
export CLI_EXTENSION=$$cli_extension; \
ext1=`echo $$cli_extension|cut -c1|tr [a-z] [A-Z]`; \
ext2=`echo $$cli_extension|cut -c2-`; \
export EXTRACT_METHOD="extract$$ext1$$ext2"; \
read -p "🌐 First part of URL that will be used to download CLI tool, e.g. if url to download CLI tool looks like https://github.com/wren-lang/wren-cli/releases/download/0.3.0/wren_cli-linux-0.3.0.zip then you should enter https://github.com/wren-lang/wren-cli/releases/download: " cli_url; \
[ -z "$$cli_url" ] && echo '❌ CLI URL cannot be empty.' && exit 1; \
export CLI_URL=$$cli_url; \
read -p "🔢 Latest available version of $$tool_name tool: " latest_version; \
[ -z "$$latest_version" ] && echo '❌ Version cannot be empty.' && exit 1; \
export LATEST_VERSION=$$latest_version; \
envsubst < README.md.template > README.md; \
rm -f README.md.template; \
envsubst < action.yml.template > action.yml; \
rm -f action.yml.template; \
envsubst < CONTRIBUTING.md.template > CONTRIBUTING.md; \
rm -f CONTRIBUTING.md.template; \
export LICENSE_YEAR=$$(date +'%Y'); \
envsubst < LICENSE.template > LICENSE; \
rm -f LICENSE.template; \
envsubst < package.json.template > package.json; \
rm -f package.json.template; \
envsubst < .github.template/pull_request_template.md.template > .github.template/pull_request_template.md; \
rm -f .github.template/pull_request_template.md.template; \
envsubst < .github.template/ISSUE_TEMPLATE/bug_report.md.template > .github.template/ISSUE_TEMPLATE/bug_report.md; \
rm -f .github.template/ISSUE_TEMPLATE/bug_report.md.template; \
envsubst < .github.template/ISSUE_TEMPLATE/feature_request.md.template > .github.template/ISSUE_TEMPLATE/feature_request.md; \
rm -f .github.template/ISSUE_TEMPLATE/feature_request.md.template; \
envsubst < .github.template/workflows/unit-tests.yml.template > .github.template/workflows/unit-tests.yml; \
rm -f .github.template/workflows/unit-tests.yml.template; \
envsubst < src/consts.ts.template > src/consts.ts; \
rm -f src/consts.ts.template; \
envsubst < src/Unarchiver.ts.template > src/Unarchiver.ts; \
rm -f src/Unarchiver.ts.template
@rm -rf .github
@mv .github.template .github
@mv .pre-commit-config.yaml.template .pre-commit-config.yaml
@echo "🌟 Done"
@rm -f Makefile
build:
pre-commit install --hook-type pre-commit
pre-commit install --hook-type pre-push