diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a090996..d387924 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -73,8 +73,8 @@ jobs: publish: name: Publish extra information about the build + if: startsWith(github.ref, 'refs/heads/master') needs: test - runs-on: ubuntu-latest steps: @@ -95,3 +95,40 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + release-candidate: + name: Publish a release candidate + if: startsWith(github.ref, 'refs/tags/v') + needs: test + runs-on: ubuntu-latest + + steps: + - name: Checkout repo + uses: actions/checkout@v2 + + - name: Get the version + id: get_version + run: echo ::set-output name=VERSION::$(echo ${GITHUB_REF/refs\/tags\//} | sed 's/^v//') + + - name: Set the tag name to package.json + run: >- + node -e " + const fs = require('fs'); + const packageJson = require('./package.json'); + const version = '${{ steps.get_version.outputs.VERSION }}'; + fs.writeFileSync('./package.json', JSON.stringify({ ...packageJson, version })); + " + + - name: Setup node.js + uses: actions/setup-node@v2 + with: + node-version: '16' + registry-url: 'https://registry.npmjs.org' + + - name: Install deps and build (with cache) + uses: bahmutov/npm-install@v1 + + - name: Release + run: npm publish --tag next + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.releaserc b/.releaserc deleted file mode 100644 index c1f1b87..0000000 --- a/.releaserc +++ /dev/null @@ -1,15 +0,0 @@ -{ - "branches": [ - { - "name": "master" - }, - { - "name": "rc", - "prerelease": "rc" - }, - { - "name": "(rc-*|rc-*/*)", - "prerelease": "${name.replace(/[^a-zA-Z0-9]+/g, '-')}" - }, - ] -} diff --git a/README.md b/README.md index 5c858bd..7bc369a 100644 --- a/README.md +++ b/README.md @@ -53,23 +53,12 @@ and [semantic-release](https://github.com/semantic-release/semantic-release) for ### Release Candidates -To make a (temporary) release candidate, you can use the following commands: +To make a (temporary) release candidate, push a new tag. The version in `package.json` will be the same as the tagname without the `v` prefix. ```bash -# Create a new rc from the latest/remote develop -npm run release-candidate +git tag v5.0.0-rc.1 && git push origin v5.0.0-rc.1 ``` -or - -```bash -# Create a new rc from a specific branch -npm run release-candidate -- feature/SKED-XXXX -``` - -That command will make a new `rc` branch (locally and remotely) on which `semantic-release` is configured -to create a new release candidate (see `.releaserc`). - ### Final Releases Since `semantic-release` is currently configured to run on any `push`'es to `master`, diff --git a/npm_scripts/release-candidate.sh b/npm_scripts/release-candidate.sh deleted file mode 100755 index 88e2d2d..0000000 --- a/npm_scripts/release-candidate.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env bash - -BRANCH_INITIAL=`git branch --show-current` -BRANCH_RC='rc' -BRANCH_TO_MERGE=${1} - -if [ -n "$BRANCH_TO_MERGE" ] -then - BRANCH_RC="$BRANCH_RC-$BRANCH_TO_MERGE" -fi - -LOCAL_RC=`(git show-ref --verify --quiet "refs/heads/$BRANCH_RC"); echo $?` -if [ "0" = "$LOCAL_RC" ] -then - echo "The local '$BRANCH_RC' still exists, check (and remove) it before continuing" - exit 1 -fi - - -REMOTE_RC=`(git show-branch remotes/origin/"$BRANCH_RC" 1> /dev/null 2>&1); echo $?` -if [ "0" = "$REMOTE_RC" ] -then - echo "The remote '$BRANCH_RC' still exists, check (and remove) it before continuing"; - exit 1; -fi - -set -e - -git checkout master -git pull -git checkout -b "$BRANCH_RC" -git merge "$BRANCH_TO_MERGE" --commit -m "ci(releases) merging $BRANCH_TO_MERGE for a release-candidate" -git push origin "$BRANCH_RC" - -git checkout "$BRANCH_INITIAL" - -git branch -D "$BRANCH_RC" -# Currently not recommended to delete this already -# because `semantic-release` requires the remote branch to exist -# git push origin --delete "$BRANCH_RC" --no-verify \ No newline at end of file diff --git a/package.json b/package.json index 2893870..7878e48 100644 --- a/package.json +++ b/package.json @@ -10,25 +10,21 @@ "dist", "src" ], - "engines": { - "node": "16" - }, "peerDependencies": {}, "scripts": { "start": "tsdx watch", - "build": "tsdx build", + "build": "tsdx build --format cjs,esm,umd --name SkedifyUriEncoding", "test": "npm run test:client && npm run test:src --", "test:src": "tsdx test", "test:client": "node client/test/run.js ./client/test/*-test.js", "tdd": "npm run test -- --watch", "lint": "tsdx lint client", "format": "npm run lint -- --fix", - "prepare": "husky install && tsdx build", + "prepare": "husky install && npm run build", "check-coverage": "npm run test -- --ci --coverage", "commit": "git-cz", "commit:lint": "commitlint --edit \"$1\"", - "semantic-release": "semantic-release", - "release-candidate": "npm_scripts/release-candidate.sh" + "semantic-release": "semantic-release" }, "prettier": { "printWidth": 80, diff --git a/tsdx.config.js b/tsdx.config.js index c1de693..376960e 100644 --- a/tsdx.config.js +++ b/tsdx.config.js @@ -2,8 +2,13 @@ const replace = require('@rollup/plugin-replace'); module.exports = { - // See https://github.com/formium/tsdx/issues/981 rollup(config, opts) { + // see https://github.com/formium/tsdx/issues/179 + if (config.output.format === 'umd') { + delete config.external; + } + + // See https://github.com/formium/tsdx/issues/981 config.plugins = config.plugins.map(p => p.name === 'replace' ? replace({