From 21f26878e2d3a004e8e3a05682ee945ae8ebee97 Mon Sep 17 00:00:00 2001 From: Matheus Geiger Date: Thu, 24 Feb 2022 17:06:22 -0300 Subject: [PATCH] Update azure-pipeline.yaml for Azure Pipelines --- azure-pipeline.yaml | 57 ++++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 26 deletions(-) diff --git a/azure-pipeline.yaml b/azure-pipeline.yaml index e0c3a1f..0b03bce 100644 --- a/azure-pipeline.yaml +++ b/azure-pipeline.yaml @@ -55,7 +55,7 @@ stages: pool: vmImage: ${{ parameters.vmImage }} condition: and(succeeded(), ne(variables['Build.Reason'], 'IndividualCI')) - displayName: Sonar + dependsOn: Lint_Test jobs: - job: displayName: Sonar prepare, analyze an publish @@ -78,6 +78,7 @@ stages: pool: vmImage: ${{ parameters.vmImage }} condition: and(succeeded(), ne(variables['Build.Reason'], 'IndividualCI')) + dependsOn: Sonar displayName: Publish artifact jobs: - job: @@ -91,36 +92,40 @@ stages: - stage: Publish_on_PyPI pool: vmImage: ${{ parameters.vmImage }} - condition: eq(variables['Build.SourceBranch'], 'refs/heads/master') + condition: and(eq(variables['Build.SourceBranch'], 'refs/heads/master'), ne(variables['Build.Reason'], 'IndividualCI')) + dependsOn: Publish_Artifact displayName: Publish on PyPI jobs: - job: + variables: + - group: Python library variables displayName: Publish on PyPI steps: - - script: | - set -e - pip install poetry - - #DEV - #poetry config http-basic.testpypi $(PYPI_JSM_USERNAME_TEST) $(PYPI_JSM_PASSWORD_TEST) - #poetry publish -r testpypi - - #PROD - poetry build - poetry publish -u $(PYPI_JSM_USERNAME) -p $(PYPI_JSM_PASSWORD) - displayName: 'Publish on PyPI' - - script: | - set -e - - set_variable(){ - echo "Set key $1 as $2" - echo "##vso[task.setvariable variable=$1]$2" - } - - LIB_VERSION=$(cat pyproject.toml | grep 'version' | head -1 | cut -d '"' -f 2) - - set_variable "TAG_VERSION" ${LIB_VERSION} - displayName: 'Retrieve version from pyproject.toml' + - task: CmdLine@2 + inputs: + script: | + set -e + pip install poetry + echo "poetry build >>>" + poetry build + echo "poetry publish >>>" + poetry publish -u $(PYPI_JSM_USERNAME) -p $(PYPI_JSM_PASSWORD) + - job: + displayName: 'Retrieve version from pyproject.toml' + steps: + - task: CmdLine@2 + inputs: + script: | + set -e + + set_variable(){ + echo "Set key $1 as $2" + echo "##vso[task.setvariable variable=$1]$2" + } + + LIB_VERSION=$(cat pyproject.toml | grep 'version' | head -1 | cut -d '"' -f 2) + + set_variable "TAG_VERSION" ${LIB_VERSION} - task: GitHubRelease@1 displayName: 'GitHub release (create)' inputs: