diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..29bb114aa2 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,45 @@ +trigger: + branches: + include: ['*'] + tags: + include: ['*'] + +steps: +- task: NodeTool@0 + inputs: + versionSpec: "10.15.1" + +- script: | + set -e + + NAME=$(node -p "require('./package.json').name") + VERSION=$(node -p "require('./package.json').version") + + TMP_NAME="$NAME-$VERSION.tgz" + + if [[ "$BUILD_SOURCEBRANCH" != refs/tags/* ]]; then + VERSION="$VERSION-${BUILD_SOURCEVERSION:0:8}" + fi + + TGZ_NAME="$NAME-$VERSION.tgz" + TGZ_PATH="$SYSTEM_ARTIFACTSDIRECTORY/$TGZ_NAME" + + npm pack + mv "$TMP_NAME" "$TGZ_PATH" + + echo "##vso[task.setvariable variable=TgzName]$TGZ_NAME" + echo "##vso[task.setvariable variable=TgzPath]$TGZ_PATH" + displayName: Build + +- task: PublishPipelineArtifact@0 + displayName: 'Publish Pipeline Artifact' + inputs: + artifactName: $(TgzName) + targetPath: $(TgzPath) + +- task: GitHubRelease@0 + displayName: 'Create GitHub Release' + inputs: + gitHubConnection: 'GitHub Connection' + repositoryName: $(Build.Repository.Name) + condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))