Merge pull request #2052 from LLK/semantic-release

Semantic release
This commit is contained in:
Christopher Willis-Ford 2022-08-26 07:45:43 -07:00 committed by GitHub
commit 715ce997b0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 40277 additions and 884 deletions

View file

@ -1,8 +1,12 @@
version: 2.1
orbs:
browser-tools: circleci/browser-tools@1.2.4
node: circleci/node@5.0.2
commitlint: conventional-changelog/commitlint@1.0.0
aliases:
- &defaults
docker:
- image: cimg/node:12.22.11-browsers
- image: cimg/node:lts-browsers
auth:
username: $DOCKERHUB_USERNAME
password: $DOCKERHUB_PASSWORD
@ -10,94 +14,57 @@ aliases:
environment:
NODE_ENV: production
- &setup
name: "setup"
command: |
npm --production=false ci
mkdir ./test/results
node/install-packages:
override-ci-command: npm --production=false ci
- &lint
name: "run lint tests"
command: npm run lint -- --format junit -o ./test/results/lint-results.xml
run:
name: "run lint tests"
command: npm run lint -- --format junit -o ./test/results/lint-results.xml
- &unit
name: "run unit tests"
command: JEST_JUNIT_OUTPUT_NAME=unit-jest-results.xml npm run unit -- --reporters=jest-junit
run:
name: "run unit tests"
command: JEST_JUNIT_OUTPUT_NAME=unit-jest-results.xml npm run unit -- --reporters=jest-junit
- &build
name: "run npm build"
command: |
NODE_ENV=production npm run build
- &tag-setup
name: "setup tags"
command: |
RELEASE_TIMESTAMP="$(date +'%Y%m%d%H%M%S')"
VPKG=$($(npm bin)/json -f package.json version)
echo export RELEASE_VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP} >> $BASH_ENV
echo export NPM_TAG=latest >> $BASH_ENV
if [[ "$CIRCLE_BRANCH" == hotfix/* ]]; then # double brackets are important for matching the wildcard
echo export NPM_TAG=hotfix >> $BASH_ENV
fi
run:
name: "run npm build"
command: |
NODE_ENV=production npm run build
- &deploy-gh-pages
name: "deploy to gh pages"
command: |
git config --global user.email $(git log --pretty=format:"%ae" -n1)
git config --global user.name $(git log --pretty=format:"%an" -n1)
npm run deploy -- -e $CIRCLE_BRANCH
- &deploy-npm
name: "deploy to npm"
command: |
echo "npm tag: $NPM_TAG"
echo "release version: $RELEASE_VERSION"
npm version --no-git-tag-version $RELEASE_VERSION
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
npm publish --tag $NPM_TAG
- &tag-commit
name: "tag commit in github"
command: |
echo $RELEASE_VERSION
git tag $RELEASE_VERSION
git push $CIRCLE_REPOSITORY_URL $RELEASE_VERSION
run:
name: "deploy to gh pages"
command: |
git config --global user.email $(git log --pretty=format:"%ae" -n1)
git config --global user.name $(git log --pretty=format:"%an" -n1)
npm run deploy -- -e $CIRCLE_BRANCH
jobs:
build-test:
<<: *defaults
steps:
- checkout
- run:
<<: *setup
- run:
<<: *lint
- run:
<<: *unit
- run:
<<: *build
- *setup
- *lint
- *unit
- *build
- store_test_results:
path: test/results
build-test-deploy:
<<: *defaults
steps:
- checkout
- run:
<<: *setup
- run:
<<: *lint
- run:
<<: *unit
- run:
<<: *build
- *setup
- *lint
- *unit
- *build
- store_test_results:
path: test/results
- run:
<<: *tag-setup
- run:
<<: *deploy-gh-pages
- run:
<<: *deploy-npm
- run:
<<: *tag-commit
- *deploy-gh-pages
- run: npx semantic-release
push-translations:
<<: *defaults
steps:
- checkout
- run:
<<: *setup
- *setup
- run:
name: "run i18n script"
command: |
@ -105,6 +72,10 @@ jobs:
npm run i18n:push
workflows:
commitlint:
jobs:
- commitlint/lint:
target-branch: develop
build-test-no-deploy:
jobs:
- build-test:

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"

3
commitlint.config.js Normal file
View file

@ -0,0 +1,3 @@
module.exports = {
extends: ['@commitlint/config-conventional']
};

41032
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -11,6 +11,7 @@
"i18n:push": "tx-push-src scratch-editor paint-editor ./translations/en.json",
"i18n:src": "rimraf ./translations/messages && babel src > tmp.js && rimraf tmp.js && ./scripts/build-i18n-source.js ./translations/messages/ ./translations/",
"lint": "eslint . --ext .js,.jsx",
"prepare": "husky install",
"start": "webpack-dev-server",
"test": "npm run lint && npm run unit && NODE_ENV=production npm run build",
"unit": "jest --reporters=default",
@ -21,7 +22,7 @@
"homepage": "https://github.com/LLK/scratch-paint#readme",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/LLK/scratch-paint.git"
"url": "https://github.com/LLK/scratch-paint.git"
},
"dependencies": {
"@scratch/paper": "0.11.20200728195508",
@ -47,6 +48,8 @@
"scratch-render-fonts": "^1.0.0-prerelease.20210401210003"
},
"devDependencies": {
"@commitlint/cli": "17.0.3",
"@commitlint/config-conventional": "17.0.3",
"autoprefixer": "9.7.4",
"babel-cli": "6.26.0",
"babel-core": "6.26.3",
@ -66,6 +69,7 @@
"eslint-plugin-react": "7.20.3",
"gh-pages": "3.2.3",
"html-webpack-plugin": "3.2.0",
"husky": "8.0.1",
"jest": "22.4.4",
"jest-canvas-mock": "2.3.1",
"jest-junit": "13.0.0",
@ -93,6 +97,7 @@
"rimraf": "2.7.1",
"scratch-l10n": "3.14.20220826031556",
"scratch-render-fonts": "1.0.0-prerelease.20210401210003",
"scratch-semantic-release-config": "1.0.2",
"style-loader": "1.3.0",
"svg-url-loader": "3.0.3",
"tap": "14.11.0",
@ -102,6 +107,11 @@
"webpack-cli": "3.3.12",
"webpack-dev-server": "3.11.2"
},
"config": {
"commitizen": {
"path": "cz-conventional-changelog"
}
},
"jest": {
"setupFiles": [
"raf/polyfill",

4
release.config.js Normal file
View file

@ -0,0 +1,4 @@
module.exports = {
extends: 'scratch-semantic-release-config',
branch: 'develop'
};