mirror of
https://github.com/scratchfoundation/scratch-audio.git
synced 2024-12-31 10:22:21 -05:00
Merge pull request #208 from scratchfoundation/implement-semantic-release
Implement semantic release
This commit is contained in:
commit
76379e62ab
9 changed files with 13334 additions and 50 deletions
42
.github/workflows/ci-cd.yml
vendored
42
.github/workflows/ci-cd.yml
vendored
|
@ -3,9 +3,7 @@ name: CI/CD
|
|||
|
||||
on:
|
||||
workflow_dispatch: # Allows you to run this workflow manually from the Actions tab
|
||||
pull_request: # Runs whenever a pull request is created or updated
|
||||
push: # Runs whenever a commit is pushed to the repository
|
||||
branches: [master, develop, hotfix/*]
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
|
||||
|
@ -40,42 +38,14 @@ jobs:
|
|||
GitHub head ref: ${{ github.head_ref }}
|
||||
EOF
|
||||
|
||||
- name: Setup & Test
|
||||
run: |
|
||||
npm ci
|
||||
npm run test
|
||||
- run: npm ci
|
||||
|
||||
- name: Generate release version
|
||||
run: |
|
||||
export NODE_ENV=production
|
||||
export RELEASE_TIMESTAMP=$(date +'%Y%m%d%H%M%S')
|
||||
export VPKG=$($(npm bin)/json -f package.json version)
|
||||
export VERSION=${VPKG}-prerelease.${RELEASE_TIMESTAMP}
|
||||
echo "RELEASE_VERSION=${VERSION}" >> $GITHUB_ENV
|
||||
if [[ "${GITHUB_REF##*/}" == hotfix/* ]]; then
|
||||
echo "NPM_TAG=hotfix" >> $GITHUB_ENV
|
||||
else
|
||||
echo "NPM_TAG=latest" >> $GITHUB_ENV
|
||||
fi
|
||||
- run: npm test
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
npm run build
|
||||
npm --no-git-tag-version version $RELEASE_VERSION
|
||||
- run: npm run build
|
||||
|
||||
- name: Deploy to NPM (do a dry-run if not on master, develop, or hotfix/*)
|
||||
- name: Run semantic-release
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
NPM_TAG: ${{ env.NPM_TAG }}
|
||||
run: |
|
||||
message=$([[ "$TRIGGER_DEPLOY" == "false" ]] && echo "DRY RUN of" || echo "Deploying")
|
||||
echo "$message version $RELEASE_VERSION to $NPM_TAG"
|
||||
npm set //registry.npmjs.org/:_authToken=$NPM_TOKEN
|
||||
npm publish --tag $NPM_TAG $([[ "$TRIGGER_DEPLOY" == "false" ]] && echo "--dry-run")
|
||||
|
||||
- name: Check Release Version and Create Tag
|
||||
run: |
|
||||
if npm info | grep -q $RELEASE_VERSION; then
|
||||
git tag $RELEASE_VERSION
|
||||
git push origin $RELEASE_VERSION
|
||||
fi
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: npx --no -- semantic-release
|
||||
|
|
12
.github/workflows/commitlint.yml
vendored
Normal file
12
.github/workflows/commitlint.yml
vendored
Normal file
|
@ -0,0 +1,12 @@
|
|||
name: Lint commit messages
|
||||
on: [pull_request]
|
||||
|
||||
concurrency:
|
||||
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.sha }}"
|
||||
|
||||
jobs:
|
||||
commitlint:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: wagoid/commitlint-github-action@v5
|
1
.husky/.gitattributes
vendored
Normal file
1
.husky/.gitattributes
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
* text eol=lf
|
4
.husky/commit-msg
Executable file
4
.husky/commit-msg
Executable file
|
@ -0,0 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
npx --no-install commitlint --edit "$1"
|
17
README.md
17
README.md
|
@ -28,3 +28,20 @@ npm test
|
|||
|
||||
## Donate
|
||||
We provide [Scratch](https://scratch.mit.edu) free of charge, and want to keep it that way! Please consider making a [donation](https://secure.donationpay.org/scratchfoundation/) to support our continued engineering, design, community, and resource development efforts. Donations of any size are appreciated. Thank you!
|
||||
|
||||
## Committing
|
||||
|
||||
This project uses [semantic release](https://github.com/semantic-release/semantic-release) to ensure version bumps
|
||||
follow semver so that projects depending on it don't break unexpectedly.
|
||||
|
||||
In order to automatically determine version updates, semantic release expects commit messages to follow the
|
||||
[conventional-changelog](https://github.com/bcoe/conventional-changelog-standard/blob/master/convention.md)
|
||||
specification.
|
||||
|
||||
You can use the [commitizen CLI](https://github.com/commitizen/cz-cli) to make commits formatted in this way:
|
||||
|
||||
```bash
|
||||
npm install -g commitizen@latest cz-conventional-changelog@latest
|
||||
```
|
||||
|
||||
Now you're ready to make commits using `git cz`.
|
||||
|
|
4
commitlint.config.js
Normal file
4
commitlint.config.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
module.exports = {
|
||||
extends: ['@commitlint/config-conventional'],
|
||||
ignores: [message => message.startsWith('chore(release):')]
|
||||
};
|
13267
package-lock.json
generated
13267
package-lock.json
generated
File diff suppressed because it is too large
Load diff
23
package.json
23
package.json
|
@ -1,42 +1,53 @@
|
|||
{
|
||||
"name": "scratch-audio",
|
||||
"version": "0.1.0",
|
||||
"version": "0.0.0",
|
||||
"description": "audio engine for scratch 3.0",
|
||||
"main": "dist.js",
|
||||
"browser": "./src/index.js",
|
||||
"scripts": {
|
||||
"test": "npm run lint && npm run tap && npm run build",
|
||||
"build": "webpack --bail",
|
||||
"watch": "webpack --watch",
|
||||
"lint": "eslint .",
|
||||
"tap": "tap test/effects/*.js test/*.js"
|
||||
"prepare": "husky install",
|
||||
"tap": "tap test/effects/*.js test/*.js",
|
||||
"test": "npm run lint && npm run tap && npm run build",
|
||||
"watch": "webpack --watch"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/LLK/scratch-audio.git"
|
||||
"url": "git+https://github.com/scratchfoundation/scratch-audio.git"
|
||||
},
|
||||
"author": "Massachusetts Institute of Technology",
|
||||
"license": "BSD-3-Clause",
|
||||
"bugs": {
|
||||
"url": "https://github.com/LLK/scratch-audio/issues"
|
||||
},
|
||||
"homepage": "https://github.com/LLK/scratch-audio#readme",
|
||||
"homepage": "https://github.com/scratchfoundation/scratch-audio#readme",
|
||||
"dependencies": {
|
||||
"audio-context": "1.0.1",
|
||||
"minilog": "^3.0.1",
|
||||
"startaudiocontext": "1.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@commitlint/cli": "18.4.3",
|
||||
"@commitlint/config-conventional": "18.4.3",
|
||||
"babel-core": "6.26.3",
|
||||
"babel-eslint": "10.1.0",
|
||||
"babel-loader": "7.1.5",
|
||||
"babel-preset-env": "1.7.0",
|
||||
"eslint": "8.0.1",
|
||||
"eslint-config-scratch": "9.0.3",
|
||||
"husky": "8.0.3",
|
||||
"json": "9.0.6",
|
||||
"scratch-semantic-release-config": "1.0.8",
|
||||
"semantic-release": "19.0.5",
|
||||
"tap": "12.7.0",
|
||||
"web-audio-test-api": "0.5.2",
|
||||
"webpack": "4.46.0",
|
||||
"webpack-cli": "3.3.12"
|
||||
},
|
||||
"config": {
|
||||
"commitizen": {
|
||||
"path": "cz-conventional-changelog"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
14
release.config.js
Normal file
14
release.config.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
module.exports = {
|
||||
extends: 'scratch-semantic-release-config',
|
||||
branches: [
|
||||
{
|
||||
name: 'develop'
|
||||
// default channel
|
||||
},
|
||||
{
|
||||
name: 'hotfix/*',
|
||||
channel: 'hotfix',
|
||||
prerelease: 'hotfix'
|
||||
}
|
||||
]
|
||||
};
|
Loading…
Reference in a new issue