Skip to content

Commit 9138acf

Browse files
committed
fix(release): adjust how the version number is determined pre build
1 parent cd34bc0 commit 9138acf

9 files changed

+138
-56
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@
55
.vscode
66
*.so
77

8-
node_modules
8+
node_modules
9+
.version

.releaserc.json

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"ci": true,
3+
"branches": [
4+
"master"
5+
],
6+
"debug": true,
7+
"dryRun": false,
8+
"plugins": [
9+
"@semantic-release/commit-analyzer",
10+
"@semantic-release/release-notes-generator",
11+
"@semantic-release/changelog",
12+
"@semantic-release/npm",
13+
[
14+
"@semantic-release/git",
15+
{
16+
"assets": [
17+
"CHANGELOG.md",
18+
"package.json"
19+
],
20+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
21+
}
22+
],
23+
[
24+
"@semantic-release/github",
25+
{
26+
"assets": [
27+
{
28+
"path": "hobbits/centos7_gcc48_release/hobbits_centos7_gcc48_release.tgz",
29+
"label": "Hobbits (64-bit CentOS 7 GCC 4.8)"
30+
},
31+
{
32+
"path": "hobbits/ubuntu18_gcc7_release/hobbits_ubuntu18_gcc7_release.tgz",
33+
"label": "Hobbits (64-bit Ubuntu 18.04 GCC 7)"
34+
},
35+
{
36+
"path": "hobbits/windows_release/hobbits_windows_release.zip",
37+
"label": "Hobbits (64-bit Windows 2016 msvc2017)"
38+
},
39+
{
40+
"path": "hobbits/mac_release/hobbits_mac_release.tgz",
41+
"label": "Hobbits (64-bit Mac OSX 10.14)"
42+
}
43+
]
44+
}
45+
]
46+
]
47+
}

ci/justversion.releaserc.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"ci": true,
3+
"branches": [
4+
"master"
5+
],
6+
"debug": true,
7+
"dryRun": true,
8+
"verifyConditions": [],
9+
"analyzeCommits": ["@semantic-release/commit-analyzer"],
10+
"verifyRelease": [
11+
{
12+
"path": "@semantic-release/exec",
13+
"cmd": "echo ${nextRelease.version} > .version"
14+
}
15+
],
16+
"generateNotes": [],
17+
"prepare": [],
18+
"publish": [],
19+
"success": [],
20+
"fail": [],
21+
"addChannel": []
22+
}

ci/linux.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ parameters:
55

66
steps:
77
- checkout: self
8+
persistCredentials: true
89

9-
- script: |
10+
- bash: |
11+
rm .releaserc.json
12+
cp ci/justversion.releaserc.json .releaserc.json
1013
npm ci
11-
npx semantic-release -p @semantic-release/commit-analyzer -p @semantic-release/npm
14+
npx semantic-release
1215
displayName: 'Update the version number for the build'
1316
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
1417

ci/mac.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
steps:
22
- checkout: self
3+
persistCredentials: true
34

45
- script: brew install fftw
56
displayName: 'Install FFTW3'
@@ -15,9 +16,11 @@ steps:
1516
inputs:
1617
versionSpec: '12.x'
1718

18-
- script: |
19+
- bash: |
20+
rm .releaserc.json
21+
cp ci/justversion.releaserc.json .releaserc.json
1922
npm ci
20-
npx semantic-release -p @semantic-release/commit-analyzer -p @semantic-release/npm
23+
npx semantic-release
2124
displayName: 'Update the version number for the build'
2225
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
2326

ci/windows.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
steps:
22
- checkout: self
3+
persistCredentials: true
34

45
- task: UsePythonVersion@0
56
inputs:
@@ -9,9 +10,11 @@ steps:
910
inputs:
1011
versionSpec: '12.x'
1112

12-
- script: |
13+
- bash: |
14+
rm .releaserc.json
15+
cp ci/justversion.releaserc.json .releaserc.json
1316
npm ci
14-
npx semantic-release -p @semantic-release/commit-analyzer -p @semantic-release/npm
17+
npx semantic-release
1518
displayName: 'Update the version number for the build'
1619
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
1720

package-lock.json

+43
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-48
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,7 @@
11
{
22
"name": "hobbits",
3-
"version": "0.20.1",
3+
"version": "0.20.2",
44
"private": true,
5-
"release": {
6-
"ci": true,
7-
"branches": [
8-
"master"
9-
],
10-
"debug": true,
11-
"dryRun": false,
12-
"plugins": [
13-
"@semantic-release/commit-analyzer",
14-
"@semantic-release/release-notes-generator",
15-
"@semantic-release/changelog",
16-
"@semantic-release/npm",
17-
[
18-
"@semantic-release/git",
19-
{
20-
"assets": [
21-
"CHANGELOG.md",
22-
"package.json"
23-
],
24-
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
25-
}
26-
],
27-
[
28-
"@semantic-release/github",
29-
{
30-
"assets": [
31-
{
32-
"path": "hobbits/centos7_gcc48_release/hobbits_centos7_gcc48_release.tgz",
33-
"label": "Hobbits (64-bit CentOS 7 GCC 4.8)"
34-
},
35-
{
36-
"path": "hobbits/ubuntu18_gcc7_release/hobbits_ubuntu18_gcc7_release.tgz",
37-
"label": "Hobbits (64-bit Ubuntu 18.04 GCC 7)"
38-
},
39-
{
40-
"path": "hobbits/windows_release/hobbits_windows_release.zip",
41-
"label": "Hobbits (64-bit Windows 2016 msvc2017)"
42-
},
43-
{
44-
"path": "hobbits/mac_release/hobbits_mac_release.tgz",
45-
"label": "Hobbits (64-bit Mac OSX 10.14)"
46-
}
47-
]
48-
}
49-
]
50-
]
51-
},
525
"config": {
536
"commitizen": {
547
"path": "node_modules/@commitlint/prompt"
@@ -71,6 +24,7 @@
7124
"@commitlint/prompt": "^8.3.5",
7225
"@semantic-release/changelog": "^5.0.0",
7326
"@semantic-release/commit-analyzer": "^8.0.1",
27+
"@semantic-release/exec": "^5.0.0",
7428
"@semantic-release/git": "^9.0.0",
7529
"@semantic-release/github": "^7.0.3",
7630
"@semantic-release/npm": "^7.0.3",

src/qmake_version_args.sh

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
#!/bin/sh
22

3-
echo DEFINES+=\"HOBBITS_GUI_VERSION=\\\"\\\\\\\"`node -pe "require('../package.json').version"`\\\\\\\"\\\"\" DEFINES+=\"HOBBITS_CORE_LIB_VERSION=\\\"\\\\\\\"`node -pe "require('../package.json').version"`\\\\\\\"\\\"\" DEFINES+=\"HOBBITS_RUNNER_VERSION=\\\"\\\\\\\"`node -pe "require('../package.json').version"`\\\\\\\"\\\"\"
3+
export HOBBITS_VERSION=`git rev-parse HEAD`
4+
if [ -e ../.version ]
5+
then
6+
export HOBBITS_VERSION=`cat ../.version`
7+
fi
8+
9+
echo DEFINES+=\"HOBBITS_GUI_VERSION=\\\"\\\\\\\"$HOBBITS_VERSION\\\\\\\"\\\"\" DEFINES+=\"HOBBITS_CORE_LIB_VERSION=\\\"\\\\\\\"$HOBBITS_VERSION\\\\\\\"\\\"\" DEFINES+=\"HOBBITS_RUNNER_VERSION=\\\"\\\\\\\"$HOBBITS_VERSION\\\\\\\"\\\"\"

0 commit comments

Comments
 (0)