diff --git a/.azure-pipelines-next.yml b/.azure-pipelines-next.yml deleted file mode 100644 index 616dffe6..00000000 --- a/.azure-pipelines-next.yml +++ /dev/null @@ -1,59 +0,0 @@ -trigger: - - next - -jobs: - - job: Linux - pool: - vmImage: ubuntu-16.04 - strategy: - matrix: - node_10_x: - node_version: 10.x - steps: - - task: NodeTool@0 - inputs: - versionSpec: $(node_version) - displayName: "Install Node.js $(node_version)" - - - task: CacheBeta@0 - inputs: - key: yarn | $(Agent.OS) | yarn.lock - path: $(YARN_CACHE_FOLDER) - displayName: Cache Yarn packages - - - script: yarn --frozen-lockfile - displayName: "Install dependencies" - - - script: yarn build - displayName: "Build" - - - script: yarn lint - displayName: "Check linting" - condition: succeeded() - - - script: yarn test:ci - displayName: "Run tests" - condition: succeeded() - - - task: PublishTestResults@2 - displayName: "Publish test results" - condition: succeededOrFailed() - inputs: - testRunner: JUnit - testResultsFiles: "junit.xml" - testRunTitle: "CI Tests $(Agent.OS)" - - - task: PublishCodeCoverageResults@1 - displayName: "Publish test coverage results" - condition: succeededOrFailed() - inputs: - codeCoverageTool: Cobertura - summaryFileLocation: "$(Build.SourcesDirectory)/coverage/cobertura-coverage.xml" - - - script: yarn semantic-release || true - displayName: Release - condition: succeeded() - -variables: - CI: true - YARN_CACHE_FOLDER: $(Pipeline.Workspace)/.yarn diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 42e7e5f2..4b51946a 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -1,8 +1,28 @@ trigger: - - master + branches: + include: + - master + tags: + include: + - latest jobs: + - job: Release + condition: eq(variables['Build.SourceBranch'], 'refs/tags/latest') + pool: + vmImage: ubuntu-16.04 + steps: + - template: .azure-pipelines-steps.yml + - bash: | + echo "##vso[task.setvariable variable=PACKAGE_VERSION]$(cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')" + echo "##vso[task.setvariable variable=CURRENT_GIT_TAG]$(git describe --tags | tr -d '[:space:]')" + - script: npm dist-tag add aws-spot-price@$(PACKAGE_VERSION) $(CURRENT_GIT_TAG) + displayName: "NPM dist-tag $(CURRENT_GIT_TAG)" + env: + NPM_TOKEN: $(NPM_TOKEN) + - job: Linux + condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/'), startsWith(variables['Build.SourceBranch'], 'refs/pull/')) pool: vmImage: ubuntu-16.04 strategy: @@ -24,15 +44,23 @@ jobs: organization: "hoonoh" scannerMode: "CLI" configMode: "file" - condition: and(succeeded(), eq(variables['node_version'], '10.x')) + condition: eq(variables['node_version'], '10.x') - task: SonarCloudAnalyze@1 - condition: and(succeeded(), eq(variables['node_version'], '10.x')) + condition: eq(variables['node_version'], '10.x') - task: SonarCloudPublish@1 inputs: pollingTimeoutSec: "300" - condition: and(succeeded(), eq(variables['node_version'], '10.x')) + condition: eq(variables['node_version'], '10.x') + # semantic-release run only on node 10.x & master branch (releases to next dist-tag) + - script: yarn semantic-release || true + displayName: Release + condition: and(eq(variables['node_version'], '10.x'), eq(variables['Build.SourceBranch'], 'refs/heads/master')) + env: + NPM_TOKEN: $(NPM_TOKEN) + GH_TOKEN: $(GH_TOKEN) - job: Windows + condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/'), startsWith(variables['Build.SourceBranch'], 'refs/pull/')) pool: vmImage: vs2017-win2016 strategy: @@ -51,6 +79,7 @@ jobs: - template: .azure-pipelines-steps.yml - job: macOS + condition: or(startsWith(variables['Build.SourceBranch'], 'refs/heads/'), startsWith(variables['Build.SourceBranch'], 'refs/pull/')) pool: vmImage: macos-10.13 strategy: diff --git a/package.json b/package.json index a0a6cdcd..1fe92a03 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ ] }, "release": { - "branch": "next", + "branch": "master", "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", @@ -85,11 +85,14 @@ "package.json", "CHANGELOG.md" ], - "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + "message": "chore(next): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" } ] ] }, + "publishConfig": { + "tag": "next" + }, "dependencies": { "aws-sdk": "^2.544.0", "ora": "^4.0.2",