|
| 1 | +# MSTICPy PyPI Production pipeline |
| 2 | + |
| 3 | +# This pipeline is used to publish the MSTICPy package to PyPI |
| 4 | +name: 1ES-MSTICPy-Publish-$(date:yyyyMMdd)$(rev:.r) |
| 5 | + |
| 6 | +parameters: |
| 7 | + Artifact: dist |
| 8 | + Feed: testpypi |
| 9 | + |
| 10 | +resources: |
| 11 | + repositories: |
| 12 | + - repository: msticpy |
| 13 | + name: microsoft/msticpy |
| 14 | + type: git |
| 15 | + ref: main |
| 16 | + - repository: 1ESPipelineTemplates |
| 17 | + type: git |
| 18 | + name: 1ESPipelineTemplates/1ESPipelineTemplates |
| 19 | + ref: refs/tags/release |
| 20 | + |
| 21 | +extends: |
| 22 | + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates |
| 23 | + parameters: |
| 24 | + pool: |
| 25 | + name: MSSecurity-1ES-Build-Agents-Pool |
| 26 | + image: MSSecurity-1ES-Windows-2022 |
| 27 | + os: windows |
| 28 | + variables: |
| 29 | + - name: DistDir |
| 30 | + value: $(Pipeline.Workspace)\${{ parameters.Artifact }} |
| 31 | + - name: TWINE_PASSWORD |
| 32 | + value: ${{ if eq(parameters.Feed, 'testpypi') }}${{ secrets.TEST_TWINE_PASSWORD }}${{ else }}${{ secrets.TWINE_PASSWORD }} |
| 33 | + |
| 34 | + steps: |
| 35 | + - checkout: self |
| 36 | + |
| 37 | + - task: UsePythonVersion@0 |
| 38 | + inputs: |
| 39 | + versionSpec: '>=3.10' |
| 40 | + architecture: 'x64' |
| 41 | + displayName: 'Use latest Python' |
| 42 | + |
| 43 | + - powershell: python -m pip install --upgrade pip |
| 44 | + displayName: 'Upgrade pip' |
| 45 | + - powershell: python -m pip install --upgrade build twine |
| 46 | + displayName: 'Install build and twine' |
| 47 | + - powershell: python -m pip install --upgrade keyring artifacts-keyring |
| 48 | + displayName: 'Install keyring and artifacts-keyring' |
| 49 | + |
| 50 | + - powershell: python -m build --sdist --wheel --outdir "$(DistDir)" |
| 51 | + displayName: 'Build package wheel and sdist' |
| 52 | + |
| 53 | + - task: PipAuthenticate@1 |
| 54 | + inputs: |
| 55 | + artifactFeeds: 1ESToolsOrgFeed |
| 56 | + displayName: 'Authenticate pip for internal feed' |
| 57 | + |
| 58 | + - task: TwineAuthenticate@1 |
| 59 | + inputs: |
| 60 | + artifactFeed: ${{ parameters.Feed }} |
| 61 | + displayName: 'Authenticate Twine for PyPI feed' |
| 62 | + |
| 63 | + - powershell: python -m twine upload --skip-existing --verbose "$(DistDir)/*" |
| 64 | + displayName: 'Push to PyPI feed' |
| 65 | + env: |
| 66 | + TWINE_REPOSITORY: ${{ parameters.Feed }} |
| 67 | + TWINE_USERNAME: __token__ |
| 68 | + TWINE_PASSWORD: $(TWINE_PASSWORD) |
0 commit comments