Skip to content

Commit

Permalink
Use NBGV to set package version
Browse files Browse the repository at this point in the history
  • Loading branch information
heaths committed Mar 21, 2019
1 parent 93f1999 commit 1957918
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 14 deletions.
3 changes: 2 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ jobs:
- task: Gulp@0
displayName: Compile
inputs:
targets: compile
targets: set-version compile
arguments: --series

- script: |
set -e
Expand Down
11 changes: 11 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

const gulp = require('gulp');
const clean = require('gulp-clean');
const nbgv = require('nerdbank-gitversioning');
const sourcemaps = require('gulp-sourcemaps');
const svg2png = require('gulp-svg2png');
const ts = require('gulp-typescript');
Expand All @@ -49,6 +50,16 @@ gulp.task('watch', gulp.series('compile:src'), () => {
gulp.watch('src/**/*.ts', ['compile:src']);
});

gulp.task('set-version', () => {
nbgv.getVersion().then((version) => {
if (process.env.SYSTEM_TEAMPROJECTID) {
console.log(`##vso[build.updatebuildnumber]${version.npmPackageVersion}`);
}
});

return nbgv.setPackageVersion();
})

gulp.task('clean', () => {
return gulp.src(['out', '**/*.vsix'])
.pipe(clean({read: false}));
Expand Down
83 changes: 71 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vscode-guid",
"version": "1.4.2",
"version": "0.0.0-placeholder",
"publisher": "heaths",
"displayName": "Insert GUID",
"description": "Insert GUIDs in different formats directly into the editor.",
Expand Down Expand Up @@ -100,6 +100,7 @@
"gulp-typescript": "^5.0.1",
"minimatch": "^3.0.4",
"mocha-junit-reporter": "^1.18.0",
"nerdbank-gitversioning": "^2.3.138",
"tslint": "^5.14.0",
"typescript": "^3.3.1",
"vscode": "^1.1.30"
Expand Down
14 changes: 14 additions & 0 deletions version.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://raw.githubusercontent.com/AArnott/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.4",
"buildNumberOffset": 2,
"publicReleaseRefSpec": [
"^refs/heads/master$",
"^refs/heads/v\\d+(?:\\.\\d+)?$"
],
"cloudBuild": {
"buildNumber": {
"enabled": true
}
}
}

0 comments on commit 1957918

Please sign in to comment.