forked from DS-Homebrew/TWiLightMenu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
250 lines (224 loc) · 10.5 KB
/
azure-pipelines.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
trigger:
branches:
include: ['*']
tags:
include: ['*']
name: $[format('{0:yyyyMMdd\-HHmmss}', pipeline.startTime)]
variables:
REPOSITORY_NAME: $(Build.Repository.Name)
jobs:
- job: latest_build
displayName: "Build with latest devkitARM"
pool:
vmImage: 'Ubuntu-16.04'
steps:
- script: |
curl -L https://github.com/devkitPro/pacman/releases/download/devkitpro-pacman-1.0.1/devkitpro-pacman.deb -o pacman.deb
sudo apt update
# Install haveged to ensure enough entropy
sudo apt install p7zip-full jq haveged
sudo dpkg -i pacman.deb
sudo dkp-pacman -Sy
sudo dkp-pacman -S nds-dev --noconfirm
displayName: 'Installing devkitPro and 7zip'
- script: |
export DEVKITPRO="/opt/devkitpro"
export DEVKITARM="/opt/devkitpro/devkitARM"
# export TWLNOPATCHSRLHEADER=1
sudo cp libmm7.a /opt/devkitpro/libnds/lib/libmm7.a
make package
displayName: 'Build TWiLight Menu++ with latest devkitARM'
- script: |
cd booter/
chmod +x make_cia
./make_cia --srl="booter.nds" --id_0=$(git rev-parse --short=7 HEAD) --tikID=$(git rev-parse --short=16 HEAD)
mkdir -p "../7zfile/3DS - CFW users/"
cp "booter.cia" "../7zfile/3DS - CFW users/TWiLight Menu.cia"
cd ../rungame/
chmod +x make_cia
./make_cia --srl="rungame.nds" --id_0=$(git rev-parse --short=7 HEAD) --tikID=$(git rev-parse --short=16 HEAD)
cp "rungame.cia" "../7zfile/3DS - CFW users/TWiLight Menu - Game booter.cia"
echo '##vso[task.setvariable variable=COMMIT_TAG;isOutput=true]'$(git log --format=%h -1)
echo '##vso[task.setvariable variable=COMMIT_MESSAGE;isOutput=true]'$(git log --pretty=format:"%an - %s" -1)
name: makeCias
displayName: 'Make booter and TWiLightMenu CIAs'
- script: |
rm -r 7zfile/_nds/TWiLightMenu/*menu/
# Clean .gitkeep files
rm -rf 7zfile/*/.gitkeep
rm -rf 7zfile/*/*/.gitkeep
mv 7zfile/ TWiLightMenu/
7z a TWiLightMenu.7z TWiLightMenu/
rm -r TWiLightMenu/_nds/TWiLightMenu/widescreen/
rm -r TWiLightMenu/_nds/TWiLightMenu/apfix/
7z a TWiLightMenu-Lite.7z TWiLightMenu/
cp TWiLightMenu.7z $(Build.ArtifactStagingDirectory)/TWiLightMenu.7z
cp TWiLightMenu-Lite.7z $(Build.ArtifactStagingDirectory)/TWiLightMenu-Lite.7z
condition: not(startsWith(variables['Build.SourceBranchName'], 'v'))
displayName: 'Pack 7z Package for nightly'
- script: |
mkdir 7zfile/_nds/TWiLightMenu/boxart/
mkdir 7zfile/_nds/TWiLightMenu/gamesettings/
# Clean .gitkeep files
rm -rf 7zfile/*/.gitkeep
rm -rf 7zfile/*/*/.gitkeep
# nds-bootstrap
mkdir nds-bootstrap
cd nds-bootstrap
curl -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/ahezard/nds-bootstrap/releases/latest -o nds-bootstrap.json
curl -L $(jq --raw-output '.assets[0].browser_download_url' nds-bootstrap.json) -o nds-bootstrap.7z
7z x nds-bootstrap.7z
mv nds-bootstrap.* ..
mkdir TWiLightMenu
mv release-bootstrap.ver TWiLightMenu
cd ..
curl -L https://github.com/TWLBot/Builds/blob/master/nds-bootstrap.7z?raw=true -o nds-bootstrap.7z
7z x nds-bootstrap.7z
mv nds-bootstrap/TWiLightMenu/release-bootstrap.ver 7zfile/_nds/TWiLightMenu
mv nds-bootstrap/TWiLightMenu/nightly-bootstrap.ver 7zfile/_nds/TWiLightMenu
mv nds-bootstrap/b4ds-release.nds 7zfile/Flashcard\ users/_nds/
mv nds-bootstrap/b4ds-nightly.nds 7zfile/Flashcard\ users/_nds/
mv nds-bootstrap/nds-bootstrap-release.nds 7zfile/_nds/
mv nds-bootstrap/nds-bootstrap-nightly.nds 7zfile/_nds/
mv nds-bootstrap/nds-bootstrap-hb-release.nds 7zfile/DSi\&3DS\ -\ SD\ card\ users/_nds/
mv nds-bootstrap/nds-bootstrap-hb-nightly.nds 7zfile/DSi\&3DS\ -\ SD\ card\ users/_nds/
# version.txt
echo -e "TWiLight Menu++: $(git describe --tags)\nnds-bootstrap: $(jq --raw-output '.tag_name' nds-bootstrap.json)\n\nRocketRobz, ahezard" > 7zfile/version.txt
cd 7zfile
7z a TWiLightMenu.7z .
cp TWiLightMenu.7z $(Build.ArtifactStagingDirectory)/TWiLightMenu.7z
condition: startsWith(variables['Build.SourceBranchName'], 'v')
displayName: 'Pack 7z Package for release'
- task: PublishBuildArtifacts@1
displayName: "Publish build to Azure"
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'build-devkitARM-latest'
- job: docker_build
pool:
vmImage: 'Ubuntu-16.04'
displayName: "Build with Docker using forked libnds and devkitARM r50"
steps:
- script: |
sudo apt update
sudo apt install p7zip-full
displayName: "Install 7zip"
- script: |
docker build -t twilightmenu --label twilightmenu ./docker
docker ps -a
displayName: "Build Docker image"
- script: |
docker run --rm -i -v "$(Build.SourcesDirectory):/data" twilightmenu make package
displayName: "Build TWiLightMenu++ with Docker using forked libnds and devkitARM r50"
- script: |
cd booter/
chmod +x make_cia
./make_cia --srl="booter.nds" --id_0=$(git rev-parse --short=7 HEAD) --tikID=$(git rev-parse --short=16 HEAD)
mkdir -p "../7zfile/3DS - CFW users/"
cp "booter.cia" "../7zfile/3DS - CFW users/TWiLight Menu.cia"
cd ../rungame/
chmod +x make_cia
./make_cia --srl="rungame.nds" --id_0=$(git rev-parse --short=7 HEAD) --tikID=$(git rev-parse --short=16 HEAD)
cp "rungame.cia" "../7zfile/3DS - CFW users/TWiLight Menu - Game booter.cia"
displayName: 'Make booter and TWiLightMenu CIAs'
- script: |
mv 7zfile/ TWiLightMenu/
7z a TWiLightMenu.7z TWiLightMenu/
cp TWiLightMenu.7z $(Build.ArtifactStagingDirectory)/TWiLightMenu_docker.7z
condition: not(startsWith(variables['Build.SourceBranchName'], 'v'))
displayName: 'Pack 7z Package'
- task: PublishBuildArtifacts@1
displayName: "Publish build to Azure"
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: 'build-devkitARM-Docker'
# Only run this for non-PR jobs.
- job: publish_build_twlbot
displayName: "Publish build to TWLBot"
dependsOn:
- latest_build
- docker_build
variables:
COMMIT_TAG: $[ dependencies.latest_build.outputs['makeCias.COMMIT_TAG'] ]
COMMIT_MESSAGE: $[ dependencies.latest_build.outputs['makeCias.COMMIT_MESSAGE'] ]
condition: and(succeeded('latest_build'), succeeded('docker_build'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull')))
steps:
- task: DownloadBuildArtifacts@0
inputs:
downloadPath: $(Build.ArtifactStagingDirectory)
artifactName: 'build-devkitARM-latest'
displayName: "Retrieving artifacts from devkitARM Build"
- task: DownloadBuildArtifacts@0
inputs:
downloadPath: $(Build.ArtifactStagingDirectory)
artifactName: 'build-devkitARM-Docker'
condition: not(startsWith(variables['Build.SourceBranchName'], 'v'))
displayName: "Retrieving artifacts from Docker build"
- script: |
export CURRENT_DATE=$(date +"%Y%m%d-%H%M%S")
echo '##vso[task.setvariable variable=CURRENT_DATE]'$CURRENT_DATE
echo '##vso[task.setvariable variable=CURRENT_DATE;isOutput=true]'$CURRENT_DATE
git config --global user.email "flamekat54@aol.com"
git config --global user.name "TWLBot"
git clone --depth 1 https://$GITHUB_TOKEN@github.com/TWLBot/Builds.git
cd Builds/
cp $(Build.ArtifactStagingDirectory)/build-devkitARM-latest/TWiLightMenu.7z TWiLightMenu.7z
cp $(Build.ArtifactStagingDirectory)/build-devkitARM-latest/TWiLightMenu-Lite.7z TWiLightMenu-Lite.7z
cp $(Build.ArtifactStagingDirectory)/build-devkitARM-Docker/TWiLightMenu_docker.7z TWiLightMenu_docker.7z
git stage .
git commit -m "TWiLightMenu | $(COMMIT_TAG)"
git push origin master
git tag v$CURRENT_DATE
echo '##vso[task.setvariable variable=TWLBOT_COMMIT]'$(git log -1 --format="%H")
name: commit
displayName: "Commit and push to TWLBot/Builds"
- task: GitHubRelease@0
displayName: "Release to TWLBot/Builds"
inputs:
gitHubConnection: TWLBot
repositoryName: TWLBot/Builds
action: create
target: $(TWLBOT_COMMIT)
tagSource: 'manual'
tag: v$(CURRENT_DATE)
title: TWiLightMenu | $(COMMIT_TAG)
releaseNotesSource: input
releaseNotes: $(COMMIT_MESSAGE)
assets: '$(Build.ArtifactStagingDirectory)/**/*.7z'
isPreRelease: true
addChangeLog: false
- task: GitHubRelease@0
displayName: "Release to DS-Homebrew/TWiLightMenu"
condition: startsWith(variables['Build.SourceBranchName'], 'v')
inputs:
gitHubConnection: TWLBot
repositoryName: DS-Homebrew/TWiLightMenu
action: edit
target: '$(Build.SourceVersion)'
tag: $(Build.SourceBranchName)
assets: '$(Build.ArtifactStagingDirectory)/**/*.7z'
assetUploadMode: replace
- job: send_webhook_success
dependsOn: publish_build_twlbot
displayName: Send Discord Success Webhook
condition: and(succeeded('publish_build_twlbot'), not(startsWith(variables['Build.SourceBranch'], 'refs/pull')))
variables:
CURRENT_DATE: $[ dependencies.publish_build_twlbot.outputs['commit.CURRENT_DATE'] ]
steps:
- script: |
curl -o send.sh https://raw.githubusercontent.com/DS-Homebrew/discord-webhooks/master/send-azure.sh
chmod +x send.sh
./send.sh success $WEBHOOK_URL
displayName: "Send success webhook"
- job: send_webhook_failure
dependsOn: publish_build_twlbot
displayName: Send Discord Failure Webhook
condition: and(or(failed('publish_build_twlbot'), failed('latest_build'), failed('docker_build')), not(startsWith(variables['Build.SourceBranch'], 'refs/pull')))
variables:
CURRENT_DATE: $[ dependencies.publish_build_twlbot.outputs['commit.CURRENT_DATE'] ]
steps:
- script: |
curl -o send.sh https://raw.githubusercontent.com/DS-Homebrew/discord-webhooks/master/send-azure.sh
chmod +x send.sh
./send.sh failure $WEBHOOK_URL
displayName: "Send failure webhook"