Skip to content

Commit 387ad1e

Browse files
author
Christopher - Marcel Böddecker
committed
Merge branch 'next'
2 parents cf595e5 + bb0b05d commit 387ad1e

File tree

1 file changed

+76
-39
lines changed

1 file changed

+76
-39
lines changed

templates/steps/cd.yml

Lines changed: 76 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ steps:
8080
"url": "https://github.com/ExtendRealityLtd"
8181
},
8282
"devDependencies": {
83+
"conventional-changelog-conventionalcommits": "^4.2.1",
8384
"semantic-release": "^16.0.0-beta.25",
8485
"@semantic-release/commit-analyzer": "^7.0.0-beta.4",
8586
"@semantic-release/release-notes-generator": "^7.3.1",
@@ -104,56 +105,92 @@ steps:
104105
- bash: mv -f package.json.original package.json
105106
displayName: Bring back original package.json
106107
- bash: |
107-
cat > semantic-release.template.json <<- "EOF"
108-
{
109-
"branches": [
110-
"+([1-9])?(.{+([1-9]),x}).x",
111-
"release",
112-
"master",
113-
{"name": "preview", "prerelease": "preview"}
108+
cat > semantic-release.config.js <<- "EOF"
109+
parserOpts = {
110+
revertPattern: '/^(?:Revert|revert:)\\s\'?([\\s\\S]+?)\'?\\s*This reverts commit (\\w*)\\./'
111+
};
112+
module.exports = {
113+
branches: [
114+
'+([0-9])?(.{+([0-9]),x}).x',
115+
{ name: 'master', channel: false },
116+
{ name: 'next', channel: 'next', prerelease: 'next' },
117+
{ name: 'next-major', channel: 'next-major', prerelease: 'next-major' }
114118
],
115-
"plugins": [
116-
["@semantic-release/commit-analyzer", {
117-
"parserOpts": {
118-
"revertPattern": "/^(?:Revert|revert:)\\s\"?([\\s\\S]+?)\"?\\s*This reverts commit (\\w*)\\./"
119-
},
120-
"releaseRules": [
121-
{"breaking": true, "release": "major"},
122-
{"type": "feat", "release": "minor"},
123-
{"revert": true, "release": "patch"},
124-
{"type": "fix", "release": "patch"},
125-
{"type": "refactor", "release": "patch"},
126-
{"type": "docs", "release": "patch"}
119+
tagFormat: 'v${version}',
120+
plugins: [
121+
['@semantic-release/commit-analyzer', {
122+
preset: 'conventionalcommits',
123+
parserOpts,
124+
releaseRules: [
125+
{ breaking: true, release: 'major' },
126+
{ revert: true, release: 'patch' },
127+
{ type: 'feat', release: 'minor' },
128+
{ type: 'fix', release: 'patch' },
129+
{ type: 'perf', release: 'patch' }
127130
]
128131
}],
129-
["@semantic-release/release-notes-generator", {
130-
"parserOpts": {
131-
"revertPattern": "/^(?:Revert|revert:)\\s\"?([\\s\\S]+?)\"?\\s*This reverts commit (\\w*)\\./"
132+
['@semantic-release/release-notes-generator', {
133+
preset: 'conventionalcommits',
134+
parserOpts,
135+
writerOpts: {
136+
types: [
137+
{ type: 'feat', section: 'Features' },
138+
{ type: 'fix', section: 'Bug Fixes' },
139+
{ type: 'perf', section: 'Performance Improvements' },
140+
{ type: 'docs', section: 'Documentation' },
141+
{ type: 'test', section: 'Tests' },
142+
{ type: 'refactor', section: 'Code Refactoring' },
143+
{ type: 'style', section: 'Styles' },
144+
{ type: 'build', section: 'Build System' },
145+
{ type: 'ci', section: 'Continuous Integration' }
146+
]
132147
}
133148
}],
134-
["@semantic-release/changelog", {
135-
"changelogTitle": "# Changelog"
149+
['@semantic-release/changelog', {
150+
changelogFile: 'CHANGELOG.md',
151+
changelogTitle: '# Changelog'
136152
}],
137-
["@semantic-release/npm", {
138-
"tarballDir": "."
153+
['@semantic-release/npm', {
154+
pkgRoot: '.',
155+
tarballDir: '.'
139156
}],
140-
["@semantic-release/git", {
141-
"message": "chore(release): set version to ${nextRelease.version}\n\n${nextRelease.notes}\n\nThis commit is a result of automation, thus CI shouldn't run ([skip ci]).",
142-
"assets": [
143-
"CHANGELOG.md",
144-
"package.json"
157+
['@semantic-release/git', {
158+
message: 'chore(release): set version to ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
159+
assets: [
160+
'CHANGELOG.md',
161+
'package.json'
145162
]
146163
}],
147-
["@semantic-release/exec", {
148-
"publishCmd": "bash npm-tarball-to-zip.sh"
164+
['@semantic-release/exec', {
165+
publishCmd: 'bash npm-tarball-to-zip.sh'
149166
}],
150-
["@semantic-release/github", {
151-
"assets": "*.zip"
167+
['@semantic-release/github', {
168+
assets: '*.zip',
169+
labels: 'failed-release',
170+
releasedLabels: 'released'
152171
}]
153-
]
154-
}
172+
],
173+
commitGroupsSort: (a, b) => {
174+
const order = [
175+
'Features',
176+
'Bug Fixes',
177+
'Performance Improvements',
178+
'Documentation',
179+
'Tests',
180+
'Code Refactoring',
181+
'Styles',
182+
'Build System',
183+
'Continuous Integration'
184+
]
185+
if (order.indexOf(a.title) >= order.indexOf(b.title)) {
186+
return -1
187+
} else {
188+
return 1
189+
}
190+
}
191+
};
155192
EOF
156-
displayName: Create semantic-release.template.json
193+
displayName: Create semantic-release.config.js
157194
- bash: |
158195
cat > npm-tarball-to-zip.sh <<- "EOF"
159196
tarball=$(npm list --depth 0 | sed "s/@/-/g; s/ .*/.tgz/g; 1q;")
@@ -164,7 +201,7 @@ steps:
164201
EOF
165202
displayName: Create npm-tarball-to-zip.sh
166203
# Using bash to run semantic-release doesn't continue after loading all the plugins.
167-
- powershell: npx semantic-release --extends "./semantic-release.template.json"
204+
- powershell: npx semantic-release --extends "./semantic-release.config.js"
168205
displayName: Run semantic-release
169206
env:
170207
GITHUB_TOKEN: $(GitHub.Token)

0 commit comments

Comments
 (0)