-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcircle.yml
94 lines (86 loc) · 3.4 KB
/
circle.yml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
version: 2
jobs:
build:
working_directory: ~/website
docker:
- image: lightjason/docker:web
branches:
only:
- developing
ignore:
- master
- /dev-.*/
environment:
TZ: "/usr/share/zoneinfo/Europe/Berlin"
GIT_AUTHOR_NAME: CircleCI
GIT_AUTHOR_EMAIL: [email protected]
GIT_COMMITTER_NAME: CircleCI
GIT_COMMITTER_EMAIL: [email protected]
steps:
- checkout
- run:
name: Git Clean
command: git clean -xdf
- run:
name: Git Remove Unused Branches
command: git fetch -p
- run:
name: Git Prune
command: git gc --prune=now
- run:
name: Build Hugo Website
command: hugo --ignoreCache --cleanDestinationDir
- run:
name: Minify SVGs
command: data/minifysvg.sh public/images/
- run:
name: Minify HTML
command: find public -type f -name "*.htm*" -exec data/minify.sh \{\} \;
- run:
name: Minify CSS
command: find public -type f -name "*.css" -exec data/minify.sh \{\} \;
- run:
name: Minify JS
command: find public -type f -name "*.js" -exec data/minifyjs.sh \{\} \;
- run:
name: Build Artifacts
command: tar -cvjSf site.tar.bz2 public/*
- store_artifacts:
path: site.tar.bz2
- run:
name: Moving Artifacts to Temporary
command: mv -f public /tmp
# start deployment
- run:
name: Delete Local Master Branch
command: git branch -D master || true
- run:
name: Initialize Orphan Master Branch
command: git checkout --orphan master
- run:
name: Remove Non-Usable Data
command: rm -Rf *
- run:
name: Moving Artifacts back to Repository
command: mv -f /tmp/public/* .
- run:
name: Create Circle-CI Configuration
command: echo -e 'general:\n branches:\n ignore:\n - master\n' > circle.yml
- run:
name: Create GitIgnore
command: echo -e '*.*\n!CNAME!.gitignore\n!circle.yml\n!*.html\n!*.xml\n!*.css\n!*.js\n!*.json\n!*.bib\n!*.zip\n!*.png\n!*.gif\n!*.pdf\n!*.svg\n!*.txt\n' > .gitignore
- run:
name: Create Readme
command: echo -e '# LightJason\n\nCurrent website of the [LightJason](https://lightjason.org) project' > readme.md
- run:
name: Git Branch Add
command: git add --all .
- run:
name: Git Branch Commit
command: GIT_COMMIT_MESSAGE="$(git show -s --pretty=format:%s $CIRCLE_SHA1)" && git commit -m "webpage update [$GIT_COMMIT_MESSAGE]"
- add_ssh_keys:
fingerprints:
- "68:f3:5d:d1:2e:72:7e:73:14:40:07:7e:82:04:4a:37"
- run:
name: Deployment
command: git push -f origin master