Merge pull request from LLK/semantic-release

Semantic release
This commit is contained in:
Christopher Willis-Ford 2023-04-05 15:23:17 -07:00
commit 11bd713b9c
8 changed files with 8249 additions and 41 deletions

View file

@ -1,24 +1,61 @@
version: 2.1
orbs:
node: circleci/node@5.1.0
alias_anchors: # anchors must be defined in YAML before being used by an alias
- &should_sign
- &should-sign
or:
- equal: [ develop, << pipeline.git.branch >> ]
- equal: [ main, << pipeline.git.branch >> ]
workflows:
version: 2
build:
version-build-release:
jobs:
- semver
- build-mac:
context: scratch-desktop-and-link
requires:
- semver
- release:
requires:
- build-mac
filters:
branches:
only:
- develop
- main
jobs:
semver:
executor: node/default
steps:
- checkout
- node/install # will use .nvmrc
- node/install-packages
- make-semantic-release-remote
# In release branches, this will calculate the version and save that to package.json so the build can use it.
# In other branches, it'll just check the semantic-release config.
# Note that if semantic-release makes changes it will automatically push them.
# That's the whole reason for the weird "local remote" stuff.
# See also: https://github.com/semantic-release/semantic-release/issues/964
- run: npx --no -- semantic-release
- persist-semantic-release-remote
release:
executor: node/default
steps:
- checkout
- node/install # will use .nvmrc
- checkout-semantic-release-remote
- run:
name: Pushing semantic-release changes for real
command: |
git push --tags origin << pipeline.git.branch >>
git push origin 'refs/notes/*' # semantic-release tracks channels with notes
build-mac:
macos:
xcode: 14.2 # warning MM0079: The recommended Xcode version for Xamarin.Mac 9.0.0 is Xcode 14.1 or later.
environment:
HOMEBREW_NO_AUTO_UPDATE: 1 # save some time
steps:
- checkout
- checkout-semantic-release-remote
- run:
name: Build Safari helper
command: |
@ -37,15 +74,13 @@ jobs:
paths: # Caching an archive instead of loose files works around CircleCI's issues with extracting links and permissions on macOS
- /tmp/visual-studio-mac.tar.gz
- unless:
condition:
*should_sign
condition: *should-sign
steps:
- do_mac_build:
configuration: Debug
artifact_tag: Debug
- when:
condition:
*should_sign
condition: *should-sign
steps:
- add_ssh_keys
- run:
@ -68,6 +103,30 @@ jobs:
- store_artifacts:
path: Artifacts/
commands:
make-semantic-release-remote:
steps:
- run:
name: Make local 'remote' for semantic-release
command: |
git fetch origin 'refs/notes/*:refs/notes/*' # semantic-release tracks channels with notes
git clone . --bare --mirror semantic-release-remote # mirror copies notes
git remote set-url origin "file://$(realpath semantic-release-remote)" # semantic-release needs a proper URL
persist-semantic-release-remote:
steps:
- persist_to_workspace:
root: .
paths: semantic-release-remote
checkout-semantic-release-remote:
steps:
- checkout
- attach_workspace:
at: .
- run:
name: Pull semantic-release changes from local 'remote'
command: |
git remote add semantic-release semantic-release-remote
git pull --tags semantic-release << pipeline.git.branch >>
git fetch semantic-release 'refs/notes/*:refs/notes/*' # semantic-release tracks channels with notes
do_mac_build:
parameters:
configuration:

1
.husky/.gitattributes vendored Normal file
View file

@ -0,0 +1 @@
* text eol=lf

4
.husky/commit-msg Executable file
View file

@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install commitlint --edit "$1"

4
commitlint.config.js Normal file
View file

@ -0,0 +1,4 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
ignores: [message => message.startsWith('chore(release):')]
};

8153
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -4,7 +4,24 @@
"description": "Scratch Link is not published as an NPM package. This file only exists to facilitate installation of devDependencies.",
"author": "Scratch Foundation",
"license": "BSD-3-Clause",
"scripts": {
"prepare": "husky install"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"devDependencies": {
"scratch-vm": "1.5.27"
"@commitlint/cli": "17.5.1",
"@commitlint/config-conventional": "17.4.4",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "9.0.2",
"@semantic-release/git": "10.0.1",
"@semantic-release/npm": "10.0.2",
"@semantic-release/release-notes-generator": "10.0.3",
"husky": "8.0.3",
"scratch-vm": "1.5.27",
"semantic-release": "21.0.1"
}
}

32
release.config.js Normal file
View file

@ -0,0 +1,32 @@
module.exports = {
branches: [
"main",
{
name: "develop",
prerelease: true
}
],
plugins: [
'@semantic-release/commit-analyzer',
'@semantic-release/release-notes-generator',
[
'@semantic-release/changelog',
{
changelogTitle: '# Changelog\n\nAll notable changes to this project will be documented in this file. See\n[Conventional Commits](https://conventionalcommits.org) for commit guidelines.'
}
],
[
'@semantic-release/npm',
{
npmPublish: false
}
],
[
'@semantic-release/git',
{
// eslint-disable-next-line no-template-curly-in-string
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
}
]
]
};

View file

@ -24,6 +24,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
README.md = README.md
stylecop.json = stylecop.json
TRADEMARK = TRADEMARK
package.json = package.json
release.config.js = release.config.js
EndProjectSection
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "scratch-link-common", "scratch-link-common\scratch-link-common.shproj", "{06B5D2A3-AD0A-4704-B00D-BCFF634E7709}"