-
Notifications
You must be signed in to change notification settings - Fork 0
/
.deploy
36 lines (29 loc) · 1.11 KB
/
.deploy
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
BEGIN
;; Load version from CHANGELOG.md file.
(set version (re:get "/v\([0-9.]+\)/" (file:read "CHANGELOG.md") 1))
(assert (version) "Could not find version in CHANGELOG.md")
(assert (le? (len (version)) 11) "Version is too long")
(assert (ge? (len (version)) 5) "Version is too short")
;; Check if there are no changes to deploy.
(assert (ne? (version) (file:read "VERSION.txt")) "(clr 97)No new version found to deploy(clr 0)")
(set-var NEW_VERSION (version))
;; Patch version.
(file:write "src/Main.php"
(re:replace "/return '.+'; \/\/@version/" "return '(version)'; //@version" (file:read "src/Main.php"))
)
END
ECHO {clr 92}Running tests ...{clr 0}
RUN test\\run.bat
ECHO
ECHO {clr 92}Updating documentation ...{clr 0}
RUN rose :vdocs src
ECHO {clr 92}Commiting ...{clr 0}
r0 {NEW_VERSION}
WRITE VERSION.txt
RUN git add .
RUN git commit -m "{coalesce {args.0} 'v{NEW_VERSION}'}"
ECHO {clr 92}Pushing ...{clr 0}
RUN git push
RUN git tag v{NEW_VERSION}
RUN git push --tags
ECHO {clr 92}* Completed deployment: v{NEW_VERSION}{clr 0}