From da5b2fd0c3e8d50336bf6668580d045095f5c8b8 Mon Sep 17 00:00:00 2001 From: Kevin van Zonneveld Date: Thu, 4 Apr 2024 17:52:09 +0200 Subject: [PATCH] Support releasing via git tags & ci --- .github/workflows/ci.yml | 9 +++++++++ package.json | 7 +------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d8ab61167a..2bbe8e332e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,6 +26,8 @@ jobs: path: | ${{ steps.yarn-cache-dir-path.outputs.dir }} .yarn + website/.yarn + dist/.yarn key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- @@ -41,6 +43,13 @@ jobs: - name: Test run: | corepack yarn test + - name: Release + if: startsWith(github.ref, 'refs/tags/') + run: | + cd dist/ + npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Website Build if: github.ref == 'refs/heads/main' run: | diff --git a/package.json b/package.json index bed19af77a..edc5564993 100644 --- a/package.json +++ b/package.json @@ -65,10 +65,9 @@ }, "readmeFilename": "README.md", "scripts": { - "beautify": "env INVIG_PRETTIER=1 invig --src src", "browser:bundle": "browserify test/browser/app.js --outfile test/browser/bundle.js", "browser:watch": "budo test/browser/app.js --live --serve test/browser/bundle.js", - "build:dist": "babel src --out-dir dist --source-maps && cp package.json dist/", + "build:dist": "babel src --out-dir dist --source-maps && cp package.json dist/ && cd dist/ && yarn", "build:indices": "babel-node src/_util/cli.js reindex", "build:tests:noskip": "rimraf test/languages && babel-node src/_util/cli.js writetests --noskip", "build:tests": "rimraf test/languages && babel-node src/_util/cli.js writetests", @@ -81,10 +80,6 @@ "lint:js": "eslint --ext .js,.jsx,.ts,.tsx .", "lint": "npm-run-all --parallel 'lint:**'", "playground:start": "cd test/browser && babel-node server.js", - "release:major": "cross-env SEMANTIC=major yarn release", - "release:minor": "cross-env SEMANTIC=minor yarn release", - "release:patch": "cross-env SEMANTIC=patch yarn release", - "release": "git commit CHANGELOG.md -m 'Update CHANGELOG.md' && npm version ${SEMANTIC:-patch} -m \"Release %s\" && git push --tags && git push && yarn build:dist && cd dist && npm publish", "test:languages:noskip": "yarn build:tests:noskip && cross-env DEBUG='locutus:*' mocha --compilers js:babel-register --reporter spec --recursive test/languages --grep \"${TEST_GREP:-}\"", "test:languages": "yarn build:tests && cross-env DEBUG='locutus:*' mocha --compilers js:babel-register --reporter spec --recursive test/languages --grep \"${TEST_GREP:-}\"", "test:module": "babel-node test/module/module.js",