ci: use semantic-release

This commit is contained in:
Christopher Willis-Ford 2023-12-20 19:07:52 -08:00
parent def2c92e39
commit cb7098c8d4
4 changed files with 9906 additions and 53 deletions

View file

@ -2,9 +2,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 }}"
@ -50,38 +48,14 @@ 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}
- run: npm run build
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
- 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 }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
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
if [[ ${{contains(github.ref, 'hotfix/')}} ]]; then
sed -e "s|hotfix/REPLACE|${{ github.ref_name }}|" --in-place release.config.js
fi
npx --no -- semantic-release

9903
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,13 @@
{
"name": "scratch-render",
"version": "0.1.0",
"version": "0.0.0",
"description": "WebGL Renderer for Scratch 3.0",
"author": "Massachusetts Institute of Technology",
"license": "BSD-3-Clause",
"homepage": "https://github.com/LLK/scratch-render#readme",
"homepage": "https://github.com/scratchfoundation/scratch-render#readme",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/LLK/scratch-render.git"
"url": "https://github.com/scratchfoundation/scratch-render.git"
},
"main": "./dist/node/scratch-render.js",
"browser": "./src/index.js",
@ -42,7 +42,9 @@
"json": "9.0.6",
"playwright-chromium": "1.13.0",
"scratch-render-fonts": "1.0.0-prerelease.20231017225105",
"scratch-semantic-release-config": "1.0.8",
"scratch-vm": "0.2.0-prerelease.20201125065300",
"semantic-release": "19.0.5",
"tap": "11.1.5",
"travis-after-all": "1.4.5",
"uglifyjs-webpack-plugin": "1.3.0",

10
release.config.js Normal file
View file

@ -0,0 +1,10 @@
module.exports = {
extends: 'scratch-semantic-release-config',
branches: [
{
name: 'develop'
// default channel
}
// TODO: add hotfix config after at least one normal release
]
};