ci: use semantic-release

This commit is contained in:
Christopher Willis-Ford 2023-12-20 11:15:41 -08:00
parent c503e1d70f
commit d531b86ff9
4 changed files with 5454 additions and 38 deletions

View file

@ -45,38 +45,11 @@ jobs:
mkdir -p ./test/results
npm test
- name: Generate release version
run: |
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
- 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

5435
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "scratch-svg-renderer",
"version": "0.2.0",
"version": "0.0.0",
"description": "SVG renderer for Scratch",
"main": "./src/index.js",
"scripts": {
@ -15,10 +15,10 @@
},
"author": "Massachusetts Institute of Technology",
"license": "BSD-3-Clause",
"homepage": "https://github.com/LLK/scratch-svg-renderer#readme",
"homepage": "https://github.com/scratchfoundation/scratch-svg-renderer#readme",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/LLK/scratch-svg-renderer.git"
"url": "https://github.com/scratchfoundation/scratch-svg-renderer.git"
},
"peerDependencies": {
"scratch-render-fonts": "^1.0.0-prerelease"
@ -50,6 +50,8 @@
"mkdirp": "2.0.0",
"rimraf": "3.0.2",
"scratch-render-fonts": "1.0.0-prerelease.20231017225105",
"scratch-semantic-release-config": "1.0.8",
"semantic-release": "19.0.5",
"tap": "11.1.5",
"webpack": "4.46.0",
"webpack-cli": "3.3.12",

14
release.config.js Normal file
View file

@ -0,0 +1,14 @@
module.exports = {
extends: 'scratch-semantic-release-config',
branches: [
{
name: 'develop'
// default channel
},
{
name: 'hotfix/*',
channel: 'hotfix',
prerelease: 'hotfix'
}
]
};