summaryrefslogtreecommitdiff
path: root/.gitlab-ci.yml
blob: 93bfdaf1eecf9a7a68dc5aa210df9022bf19f8bc (plain) (blame)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
stages:
- sync
- deploy

image: ubuntu:18.04
before_script:
  - uname -a

legacy:
  stage: sync
  tags:
    - glados
  script:
  - apt-get -qq update
  - apt-get install -qq -y make zip zlib1g-dev zlibc python ssh rsync python3 git
  - git config --global credential.helper store
  - echo "https://numa:$SYNC_KEY@git.themanaworld.org" > ~/.git-credentials
  - git checkout master
  - git submodule update --init
  - pwd
  - cd tools
  - ./evolved.py
  - cd ..
  - git status
  - (git status --porcelain  | grep '.*') || exit 0 # skip if nothing to commit
  - git config user.email "numa@themanaworld.org"
  - git config user.name "Numa"
  - git commit -a -m "Regenerate databases" --author="Numa <numa@themanaworld.org>"
  - git push # may cause a CI loop >.<
  only:
  - master

evolved:
  stage: deploy
  tags:
    - glados
  script:
  - apt-get -qq update
  - apt-get install -qq -y make zip zlib1g-dev zlibc python ssh rsync python3 git
  - git config --global credential.helper store
  - echo "https://numa:$SYNC_KEY@git.themanaworld.org" > ~/.git-credentials
  - git clone https://git.themanaworld.org/evolved/serverdata.git evolved
  - cd evolved
  - git checkout master
  - cp -v ../world/map/db/mob_db.conf db/pre-re/
  - cp -v ../world/map/db/item_db.conf db/pre-re/
  - git status
  - (git status --porcelain  | grep '.*') || exit 0 # skip if nothing to commit
  - git config user.email "numa@themanaworld.org"
  - git config user.name "Numa"
  - git commit -a -m "Sync with Legacy repo" --author="Numa <numa@themanaworld.org>"
  - git push
  only:
  - master

pages:
  stage: deploy
  variables:
    GIT_STRATEGY: clone
    GIT_SUBMODULE_STRATEGY: recursive
    GIT_DEPTH: "1"
    UPDATE_DIR: "../../../public"
    UPDATE_HTTP: "none"
    CC: "clang"
  tags:
    - glados
  script:
  - apt-get -qq update
  - apt-get install -qq -y make clang zip zlib1g-dev zlibc python ssh rsync python3
  - mkdir public
  - make updates
  - make news
  - cp -v world/map/news.txt public/
  - cp -v world/map/news.html public/
  - cp -v world/map/news.rss public/
  - cp -v world/map/news.json public/
  - echo '<title>static update server</title><a href="TMW.zip">TMW.zip</a><br><a href="TMW-music.zip">TMW-music.zip</a><br><a href="news.txt">news.txt</a><br><a href="resources.xml">resources.xml</a>' > public/index.html
  # path for legacy compatibility
  - mkdir -p public/updates
  - cp -v public/*.* public/updates/
  - echo "Now deploying..."
  - mkdir -p ~/.ssh
  - echo "${SSH_PRIVATE_KEY}" | base64 -d | tr -d '\r' > ~/.ssh/id_rsa
  - chmod -R 700 ~/.ssh
  - rsync -e 'ssh -p 65001 -o StrictHostKeyChecking=no' -aHv --delete public/updates $MYHOST:$FILE_LOCATION
  artifacts:
    paths:
    - public
    expire_in: 1 month
  only:
  - stable

clientdata:
  stage: deploy
  tags:
    - glados
  script:
  - apt-get -qq update
  - apt-get install -qq -y make zip zlib1g-dev zlibc python ssh rsync python3 git
  - git submodule update --init
  - git config --global credential.helper store
  - echo "https://numa:$SYNC_KEY@git.themanaworld.org" > ~/.git-credentials
  - git clone https://git.themanaworld.org/evolved/clientdata.git evolved
  - cd evolved
  - git checkout master
  - cp -v ../client-data/monsters.xml .
  - rm -r graphics/sprites/monsters/*
  - cp -v --recursive ../client-data/graphics/sprites/monsters/* graphics/sprites/monsters/
  - rm -r sfx/*
  - cp -v --recursive ../client-data/sfx/* sfx/
  - git status
  - git config user.email "numa@themanaworld.org"
  - git config user.name "Numa"
  - git add graphics/sprites/monsters/
  - git commit -a -m "Sync with Legacy repo" --author="Numa <numa@themanaworld.org>"
  - git push
  only:
  - stable
  allow_failure: true