-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMakefile
66 lines (56 loc) · 2.16 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
os = $(shell uname -s)
version = 0.1.3
image = mirror-git:$(version)
cr_user = gigrator
cr_token =
cr_image = $(cr_user)/$(image)
ghcr = ghcr.io
ghcr_user = k8scat
ghcr_token =
ghcr_image = $(ghcr)/$(ghcr_user)/$(image)
.PHONY: build
build:
docker build -t $(cr_image) .
docker tag $(cr_image) $(ghcr_image)
.PHONY: login-cr
login-cr:
docker login -u $(cr_user) -p $(cr_token)
.PHONY: push-cr
push-cr: login-cr
docker push $(cr_image)
.PHONY: login-ghcr
login-ghcr:
docker login -u $(ghcr_user) -p $(ghcr_token) $(ghcr)
.PHONY: push-ghcr
push-ghcr: login-ghcr
docker push $(ghcr_image)
new_version =
.PHONY: upgrade
upgrade:
ifeq ($(new_version),)
@echo "Usage: make upgrade new_version=<new version>"
@exit 1
endif
ifeq ($(os),Darwin)
sed -i "" 's/$(version)/$(new_version)/g' Makefile
sed -i "" 's/$(version)/$(new_version)/g' action.yml
sed -i "" 's/$(version)/$(new_version)/g' README.md
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/github-to-github.yml
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/github-to-gitee.yml
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/github-to-gitlab.yml
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/github-to-bitbucket.yml
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/github-org-to-gitee-org.yml
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/github-to-gitea.yml
sed -i "" 's/$(version)/$(new_version)/g' .github/workflows/github-to-coding.yml
else
sed -i 's/$(version)/$(new_version)/g' Makefile
sed -i 's/$(version)/$(new_version)/g' action.yml
sed -i 's/$(version)/$(new_version)/g' README.md
sed -i 's/$(version)/$(new_version)/g' .github/workflows/github-to-github.yml
sed -i 's/$(version)/$(new_version)/g' .github/workflows/github-to-gitee.yml
sed -i 's/$(version)/$(new_version)/g' .github/workflows/github-to-gitlab.yml
sed -i 's/$(version)/$(new_version)/g' .github/workflows/github-to-bitbucket.yml
sed -i 's/$(version)/$(new_version)/g' .github/workflows/github-org-to-gitee-org.yml
sed -i 's/$(version)/$(new_version)/g' .github/workflows/github-to-gitea.yml
sed -i 's/$(version)/$(new_version)/g' .github/workflows/github-to-coding.yml
endif