-
Notifications
You must be signed in to change notification settings - Fork 1
197 lines (195 loc) · 7.39 KB
/
build.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
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: "make-modpack"
on:
push:
branches:
- "mainline"
tags:
- "[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- "mainline"
jobs:
build:
runs-on: "ubuntu-latest"
outputs:
version: ${{steps.version_meta.outputs.version}}
container_version: ${{steps.version_meta.outputs.container_version}}
env:
CONTAINER_TOKEN: "${{secrets.CONTAINER_TOKEN}}"
steps:
- id: "checkout"
uses: "actions/checkout@v2"
with:
fetch-depth: 1
- name: "generate config"
id: "configgen"
run: 'echo "twitch_token: ${{ secrets.CURSE_TOKEN }}" > config.yml'
- name: "fetch tags"
if: startsWith(github.ref, 'refs/tags')
run: |
git fetch --unshallow --tags
- name: "build client thing"
id: "client_build"
run: "make github_client"
- name: "build server thing"
id: "server_build"
run: "make github_server"
- name: "set version for artifact upload"
id: "version_meta"
run: |
echo "version=$(cat $(pwd)/.version)" >> "$GITHUB_ENV"
echo "container_version=$(cat $(pwd)/.version-container)" >> "$GITHUB_ENV"
echo ::set-output name=version::$(cat $(pwd)/.version)
echo ::set-output name=container_version::$(cat $(pwd)/.version-container)
- name: "upload artifact modpack i guess"
id: "client_upload"
uses: "actions/upload-artifact@v2"
with:
name: "ttmb-client-${{env.version}}"
path: "artifacts/github/client"
- name: "upload server modpack i guess"
id: "server_upload"
uses: "actions/upload-artifact@v2"
with:
name: "ttmb-server-${{env.version}}"
path: "artifacts/github/server"
- name: "upload container on tagged builds"
if: startsWith(github.ref, 'refs/tags')
run: |
docker login ghcr.io --username otakup0pe --password-stdin <<< "$CONTAINER_TOKEN"
docker push ghcr.io/tribesthatmaybe/workflow:${{env.container_version}}
- name: "notify discord on build failure"
if: failure()
uses: "rjstone/discord-webhook-notify@v1"
with:
severity: "error"
details: "Unable to complete ttmb build"
webhookUrl: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
maybe_bump:
if: github.ref == 'refs/heads/mainline'
runs-on: "ubuntu-latest"
needs: "build"
steps:
- uses: "actions/checkout@v2"
with:
fetch-depth: 0
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.7"
- name: "install avakas"
run: |
pip install avakas
- name: "Maybe bump version"
run: |
git config user.email noreply@tribesthatmay.be
git config user.name "An Automaton"
git remote set-url origin "$(git config --get remote.origin.url | sed 's#http.*com/#git@github.com:#g')"
eval `ssh-agent -t 300 -s`
ssh-add - <<< "${{secrets.DEPLOY_KEY}}"
mkdir -p ~/.ssh/
ssh-keyscan github.com >> ~/.ssh/known_hosts
./scripts/bump.sh
ssh-agent -k
deploy:
if: startsWith(github.ref, 'refs/tags')
needs: "build"
runs-on: ubuntu-latest
env:
STICKYPISTON_USER: "${{secrets.STICKYPISTON_USER}}"
STICKYPISTON_SERVER: "${{secrets.STICKYPISTON_SERVER}}"
STICKYPISTON_HOST: "${{secrets.STICKYPISTON_HOST}}"
FTP_PASSWORD: "${{secrets.FTP_PASSWORD}}"
MULTICRAFT_API_KEY: "${{secrets.MULTICRAFT_API_KEY}}"
MULTICRAFT_API_HOST: "${{secrets.MULTICRAFT_API_HOST}}"
RCON_PORT: "${{secrets.RCON_PORT}}"
RCON_PASSWORD: "${{secrets.RCON_PASSWORD}}"
CURSEFORGE_TOKEN: "${{secrets.CURSEFORGE_TOKEN}}"
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
CONTAINER_TOKEN: "${{secrets.CONTAINER_TOKEN}}"
steps:
- uses: "actions/checkout@v2"
with:
ref: "mainline"
fetch-depth: 1
- name: "fetch server artifact"
uses: "actions/download-artifact@v2"
with:
name: "ttmb-server-${{needs.build.outputs.version}}"
path: "server-artifact"
- name: "recompress server artifact because reasons"
run: |
mkdir -p artifacts
cd server-artifact
zip -r ../artifacts/ttmb-server-${{needs.build.outputs.version}}.zip *
- name: "pull workflow container"
run: |
docker login ghcr.io --username otakup0pe --password-stdin <<< "$CONTAINER_TOKEN"
docker pull ghcr.io/tribesthatmaybe/workflow:${{needs.build.outputs.container_version}}
- name: "deploy to dev server"
run: |
./scripts/render-devsync.sh
./scripts/deploy ${{needs.build.outputs.container_version}} ${{needs.build.outputs.version}}
upload:
if: startsWith(github.ref, 'refs/tags')
runs-on: "ubuntu-latest"
needs: "build"
env:
STICKYPISTON_USER: "${{secrets.STICKYPISTON_USER}}"
STICKYPISTON_SERVER: "${{secrets.STICKYPISTON_SERVER}}"
STICKYPISTON_HOST: "${{secrets.STICKYPISTON_HOST}}"
FTP_PASSWORD: "${{secrets.FTP_PASSWORD}}"
MULTICRAFT_API_KEY: "${{secrets.MULTICRAFT_API_KEY}}"
MULTICRAFT_API_HOST: "${{secrets.MULTICRAFT_API_HOST}}"
RCON_PORT: "${{secrets.RCON_PORT}}"
RCON_PASSWORD: "${{secrets.RCON_PASSWORD}}"
CURSEFORGE_TOKEN: "${{secrets.CURSEFORGE_TOKEN}}"
GITHUB_TOKEN: "${{secrets.GITHUB_TOKEN}}"
CONTAINER_TOKEN: "${{secrets.CONTAINER_TOKEN}}"
steps:
- uses: "actions/checkout@v2"
with:
ref: "mainline"
fetch-depth: 1
- name: "fetch server artifact"
uses: "actions/download-artifact@v2"
with:
name: "ttmb-server-${{needs.build.outputs.version}}"
path: "server-artifact"
- name: "fetch client artifact"
uses: "actions/download-artifact@v2"
with:
name: "ttmb-client-${{needs.build.outputs.version}}"
path: "client-artifact"
- name: "recompress server artifact because reasons"
run: |
mkdir -p artifacts
cd server-artifact
zip -r ../artifacts/ttmb-server-${{needs.build.outputs.version}}.zip *
- name: "recompress client artifact because reasons"
run: |
mkdir -p artifacts
cd client-artifact
zip -r ../artifacts/ttmb-client-${{needs.build.outputs.version}}.zip *
- name: "pull workflow container"
run: |
docker login ghcr.io --username otakup0pe --password-stdin <<< "$CONTAINER_TOKEN"
docker pull ghcr.io/tribesthatmaybe/workflow:${{needs.build.outputs.container_version}}
- name: "upload to curseforge"
run: |
./scripts/render-devsync.sh
./scripts/upload ${{needs.build.outputs.container_version}} ${{needs.build.outputs.version}}
- name: "notify discord on upload failure"
if: failure()
uses: "rjstone/discord-webhook-notify@v1"
with:
severity: "error"
details: "Unable to complete ttmb build"
webhookUrl: ${{ secrets.DISCORD_BUILD_WEBHOOK }}
- name: "notify discord on upload success"
if: success()
uses: "rjstone/discord-webhook-notify@v1"
with:
severity: "info"
details: "New build ${{needs.build.outputs.version}} uploaded to curse"
webhookUrl: ${{ secrets.DISCORD_BUILD_WEBHOOK }}