Created
June 16, 2020 03:38
-
-
Save NightScript370/0d7d49c16dc6dc746db8bd1aa93b5232 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: 'Debian-10.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 libraries' | |
| - script: | | |
| export DEVKITPRO="/opt/devkitpro" | |
| export DEVKITARM="/opt/devkitpro/devkitARM" | |
| # export TWLNOPATCHSRLHEADER=1 | |
| 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) | |
| 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: | | |
| cd booter_fc/r4_menu_dat/ | |
| cp "../booter_fc.nds" "_DS_MENU.nds" | |
| ./dlditool r4_sd.dldi _DS_MENU.nds | |
| ./r4enc _DS_MENU.nds | |
| mv "_DS_MENU.nds.DAT" "../../7zfile/Flashcard users/Autoboot/akMenu-Wood UI root/_DS_MENU.DAT" | |
| name: makeDat | |
| displayName: 'Make WoodR4 _DS_MENU.DAT files' | |
| - script: | | |
| rm -r 7zfile/_nds/TWiLightMenu/*menu/ | |
| mv 7zfile/ TWiLightMenu/ | |
| 7z a TWiLightMenu.7z TWiLightMenu/ | |
| rm -r TWiLightMenu/_nds/TWiLightMenu/apfix/ | |
| rm -r TWiLightMenu/3DS\ -\ CFW\ users/_nds/TWiLightMenu/widescreen/ | |
| 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/ | |
| # 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/ | |
| mkdir 7zfile/DSi\&3DS\ -\ SD\ card\ users/_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: 'Debian-10.04' | |
| displayName: "Build with Docker using devKitARM r54" | |
| steps: | |
| - script: | | |
| docker build -t twilightmenu --label twilightmenu ./ | |
| docker ps -a | |
| displayName: "Build Docker image" | |
| - script: | | |
| sudo apt update | |
| sudo apt install p7zip-full | |
| displayName: "Install 7zip" | |
| - script: | | |
| docker run --rm -i -v "$(Build.SourcesDirectory):/data" twilightmenu make package | |
| displayName: "Build TWiLightMenu++ with devkitARM r54" | |
| - 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: | | |
| cd booter_fc/r4_menu_dat/ | |
| cp "../booter_fc.nds" "_DS_MENU.nds" | |
| ./dlditool r4_sd.dldi _DS_MENU.nds | |
| ./r4enc _DS_MENU.nds | |
| mv "_DS_MENU.nds.DAT" "../../7zfile/Flashcard users/Autoboot/akMenu-Wood UI root/_DS_MENU.DAT" | |
| name: makeDat | |
| displayName: 'Make WoodR4 _DS_MENU.DAT files' | |
| - script: | | |
| rm -r 7zfile/_nds/TWiLightMenu/*menu/ | |
| 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 "[email protected]" | |
| git config --global user.name "TWLBot" | |
| git clone --depth 1 https://[email protected]/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" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment