-
Notifications
You must be signed in to change notification settings - Fork 4
/
azure-pipelines.yml
153 lines (132 loc) · 6.76 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
# Python package
# Create and test a Python package on multiple Python versions.
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
trigger:
branches:
include:
- "*"
tags:
include:
- "*"
pool:
vmImage: "macOS-10.15"
strategy:
matrix:
Mojave DMG:
python.version: "3.9"
variables:
- group: Apple-Notarize-Variables
- group: AWS-Upload-Credentials
- group: GlueVariables
- group: GitHub
steps:
- checkout: self # self represents the repo where the initial Azure Pipelines YAML file was found
submodules: recursive
fetchDepth: 0
displayName: "Checkout code"
- script: |
git config --global url."https://github.com/".insteadOf ssh://[email protected]/
displayName: "Use https for git instead of ssh"
- task: UsePythonVersion@0
inputs:
versionSpec: "$(python.version)"
displayName: "Use Python $(python.version)"
# Install Apple certificate
# Install an Apple certificate required to build on a macOS agent machine
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'salvia-apple-dev-id-app.p12'
certPwd: $(SALVIA_APPLE_DEV_ID_APP_PASS)
keychain: temp
deleteCert: true
- script: |
python3 -m venv ../venv
. ../venv/bin/activate
pip install setuptools_scm
touch $(System.DefaultWorkingDirectory)/build_scripts/version.txt
python ./build_scripts/installer-version.py > $(System.DefaultWorkingDirectory)/build_scripts/version.txt
cat $(System.DefaultWorkingDirectory)/build_scripts/version.txt
deactivate
displayName: Create installer version number
- script: |
set -o errexit -o pipefail
MADMAX_VERSION=$(curl -u "$(GithubUsername):$(GithubToken)" --fail --silent "https://api.github.com/repos/Chia-Network/chia-plotter-madmax/releases/latest" | jq -r '.tag_name')
mkdir "$(System.DefaultWorkingDirectory)/madmax"
wget -O "$(System.DefaultWorkingDirectory)/madmax/salvia_plot" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${MADMAX_VERSION}/chia_plot-${MADMAX_VERSION}-macos-intel
wget -O "$(System.DefaultWorkingDirectory)/madmax/salvia_plot_k34" https://github.com/Chia-Network/chia-plotter-madmax/releases/download/${MADMAX_VERSION}/chia_plot_k34-${MADMAX_VERSION}-macos-intel
chmod +x "$(System.DefaultWorkingDirectory)/madmax/salvia_plot"
chmod +x "$(System.DefaultWorkingDirectory)/madmax/salvia_plot_k34"
displayName: "Get latest madmax release"
- script: |
sh install.sh
displayName: "Install dependencies"
- task: NodeTool@0
inputs:
versionSpec: '16.x'
displayName: "Setup Node 16.x"
- bash: |
. ./activate
APPLE_NOTARIZE_USERNAME="$(APPLE_NOTARIZE_USERNAME)"
export APPLE_NOTARIZE_USERNAME
APPLE_NOTARIZE_PASSWORD="$(APPLE_NOTARIZE_PASSWORD)"
export APPLE_NOTARIZE_PASSWORD
if [ "$(APPLE_NOTARIZE_PASSWORD)" ]; then NOTARIZE="true"; else NOTARIZE="false"; fi
export NOTARIZE
cd build_scripts || exit
sh build_macos.sh
displayName: "Build DMG with build_scripts/build_macos.sh"
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(System.DefaultWorkingDirectory)/build_scripts/final_installer/
artifactName: MacOS-DMG
displayName: "Upload MacOS DMG"
- bash: |
ls $(System.DefaultWorkingDirectory)/build_scripts/final_installer/
cd $(System.DefaultWorkingDirectory)/build_scripts/
export SALVIA_VERSION="Salvia-"$(<version.txt)
shasum -a 256 $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$SALVIA_VERSION.dmg > $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$SALVIA_VERSION.dmg.sha256
ls $(System.DefaultWorkingDirectory)/build_scripts/final_installer/
displayName: "Create Checksums"
- bash: |
export AWS_ACCESS_KEY_ID=$(AccessKey)
export AWS_SECRET_ACCESS_KEY=$(SecretKey)
export AWS_DEFAULT_REGION=us-west-2
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/*.dmg s3://download-salvia-net/builds/
displayName: "Upload to S3"
- bash: |
cd $(System.DefaultWorkingDirectory)/build_scripts/
export SALVIA_VERSION="Salvia-"$(<version.txt)
pip3 install py3createtorrent
py3createtorrent -f -t udp://tracker.opentrackr.org:1337/announce $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$SALVIA_VERSION.dmg -o $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$SALVIA_VERSION.dmg.torrent --webseed https://download-salvia-net.s3.us-west-2.amazonaws.com/install/$SALVIA_VERSION.dmg
ls
displayName: "Create torrent file"
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/'))
- bash: |
export AWS_ACCESS_KEY_ID=$(AccessKey)
export AWS_SECRET_ACCESS_KEY=$(SecretKey)
export AWS_DEFAULT_REGION=us-west-2
cd $(System.DefaultWorkingDirectory)/build_scripts/
export SALVIA_VERSION="Salvia-"$(<version.txt)
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$SALVIA_VERSION.dmg s3://download-salvia-net/beta/Salvia-intel_latest_beta.dmg
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$SALVIA_VERSION.dmg.sha256 s3://download-salvia-net/beta/Salvia-intel_latest_beta.dmg.sha256
displayName: "Upload Beta Files"
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/heads/main'))
- bash: |
export AWS_ACCESS_KEY_ID=$(AccessKey)
export AWS_SECRET_ACCESS_KEY=$(SecretKey)
export AWS_DEFAULT_REGION=us-west-2
cd $(System.DefaultWorkingDirectory)/build_scripts/
export SALVIA_VERSION="Salvia-"$(<version.txt)
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$SALVIA_VERSION.dmg s3://download-salvia-net/install/
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$SALVIA_VERSION.dmg.sha256 s3://download-salvia-net/install/
aws s3 cp $(System.DefaultWorkingDirectory)/build_scripts/final_installer/$SALVIA_VERSION.dmg.torrent s3://download-salvia-net/torrents/
displayName: "Upload Release Files"
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/'))
- bash: |
cd $(System.DefaultWorkingDirectory)/build_scripts/
export SALVIA_TAG=$(<version.txt)
export REPO_NAME=$(echo $(Build.Repository.Name) | cut -d'/' -f 2)
curl -s -XPOST -H "Authorization: Bearer $(GLUE_ACCESS_TOKEN)" --data "{\"salvia_ref\": \"$SALVIA_TAG\"}" $(GLUE_API_URL)/api/v1/${REPO_NAME}/${SALVIA_TAG}/success/build-macos
displayName: "Mark installer complete"
condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/'))