|
2 | 2 | pr:
|
3 | 3 | - master
|
4 | 4 |
|
5 |
| -# Release to pypi when a release tag is pushed |
| 5 | +# Release to PyPI when a tag (vX.X.X) is pushed to master |
6 | 6 | trigger:
|
7 | 7 | tags:
|
8 | 8 | include:
|
@@ -165,3 +165,64 @@ stages:
|
165 | 165 | - script: "pip install ."
|
166 | 166 | displayName: "Ensure mbed-greentea can be installed locally for development"
|
167 | 167 | workingDirectory: "packages/mbed-greentea"
|
| 168 | + |
| 169 | + # Collect test and build stages together before the release stages to provide a pass/fail point for the status badge. |
| 170 | + - stage: CiCheckpoint |
| 171 | + displayName: 'CI Checkpoint' |
| 172 | + dependsOn: |
| 173 | + - AnalyseTest |
| 174 | + jobs: |
| 175 | + - job: ChecksPassing |
| 176 | + displayName: 'Checks Passing' |
| 177 | + # A dummy job is required due to a bug in Azure which runs the previous job if nothing is defined. |
| 178 | + steps: |
| 179 | + - bash: echo "All prerequisite stages have passed and the package should be suitable for release." |
| 180 | + |
| 181 | + - stage: ProductionReleasePyPI |
| 182 | + displayName: 'Production Release' |
| 183 | + # Only allow production releases if the tests pass and a tag (vX.X.X) is pushed to master. |
| 184 | + dependsOn: |
| 185 | + - CiCheckpoint |
| 186 | + condition: and(succeeded(), contains(variables['build.sourceBranch'], 'refs/tags/v')) |
| 187 | + jobs: |
| 188 | + - deployment: PyPIProductionRelease |
| 189 | + displayName: 'PyPI Production Release' |
| 190 | + # Create an environment to keep track of PyPI releases |
| 191 | + environment: 'PyPI Release' |
| 192 | + strategy: |
| 193 | + runOnce: |
| 194 | + deploy: |
| 195 | + pool: |
| 196 | + vmImage: 'ubuntu-latest' |
| 197 | + steps: |
| 198 | + - checkout: self |
| 199 | + |
| 200 | + - task: UsePythonVersion@0 |
| 201 | + inputs: |
| 202 | + versionSpec: '3.7' |
| 203 | + |
| 204 | + - script: | |
| 205 | + python -m pip install --upgrade wheel |
| 206 | + python -m pip install --upgrade twine |
| 207 | + python -m pip install --upgrade setuptools-scm |
| 208 | + displayName: 'Install python modules required for release' |
| 209 | +
|
| 210 | + - template: pypi-release.yml |
| 211 | + parameters: |
| 212 | + repoName: mbed-os-tools |
| 213 | + wDirectory: $(Build.SourcesDirectory) |
| 214 | + |
| 215 | + - template: pypi-release.yml |
| 216 | + parameters: |
| 217 | + repoName: mbed-ls |
| 218 | + wDirectory: packages/mbed-ls |
| 219 | + |
| 220 | + - template: pypi-release.yml |
| 221 | + parameters: |
| 222 | + repoName: mbed-host-tests |
| 223 | + wDirectory: packages/mbed-host-tests |
| 224 | + |
| 225 | + - template: pypi-release.yml |
| 226 | + parameters: |
| 227 | + repoName: mbed-greentea |
| 228 | + wDirectory: packages/mbed-greentea |
0 commit comments