diff --git a/.github/workflows/publish-jupyterlab_robotmode.yaml b/.github/workflows/publish-jupyterlab_robotmode.yaml index ddb690cb..523707e4 100644 --- a/.github/workflows/publish-jupyterlab_robotmode.yaml +++ b/.github/workflows/publish-jupyterlab_robotmode.yaml @@ -26,7 +26,7 @@ jobs: - run: npm ci - run: git config --global user.name "release-jupyterlab_robotmode" - run: git config --global user.email "release-jupyterlab_robotmode@example.com" - - run: npm version ${{ github.event.release.tag_name }} + - run: npm version ${{ github.event.release.tag_name }} --allow-same-version - run: npm run build - run: npm test - run: npm publish diff --git a/.github/workflows/publish-robocode-kernel.yaml b/.github/workflows/publish-robocode-kernel.yaml new file mode 100644 index 00000000..25f3be5b --- /dev/null +++ b/.github/workflows/publish-robocode-kernel.yaml @@ -0,0 +1,40 @@ +# https://dev.to/michi/publish-to-npm-automatically-with-github-actions-5805 +# https://docs.github.com/en/free-pro-team@latest/actions/guides/publishing-nodejs-packages + +name: publish-robocode-kernel + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.release.target_commitish }} + - uses: actions/setup-ruby@v1 + with: + ruby-version: '2.5' + - uses: actions/setup-python@v1 + with: + python-version: '3.7' + - uses: actions/setup-node@v1 + with: + node-version: '12.x' + registry-url: 'https://npm.pkg.github.com' + scope: '@robocorp' + - run: rake what + - run: rake envsetup + - run: rake package + - run: | + npm ci + git config --global user.name "publish-robocode-kernel" + git config --global user.email "publish-robocode-kernel@example.com" + npm version ${{ github.event.release.tag_name }} --allow-same-version + npm run build + npm publish + working-directory: publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/publish/.gitignore b/publish/.gitignore new file mode 100644 index 00000000..f06235c4 --- /dev/null +++ b/publish/.gitignore @@ -0,0 +1,2 @@ +node_modules +dist diff --git a/publish/package-lock.json b/publish/package-lock.json new file mode 100644 index 00000000..43cc9d90 --- /dev/null +++ b/publish/package-lock.json @@ -0,0 +1,137 @@ +{ + "name": "@robocorp/robocode-kernel", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "glob": { + "version": "7.1.6", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz", + "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", + "dev": true + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", + "dev": true, + "requires": { + "resolve": "^1.1.6" + } + }, + "resolve": { + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.17.0.tgz", + "integrity": "sha512-ic+7JYiV8Vi2yzQGFWOkiZD5Z9z7O2Zhm9XMaTxdJExKasieFCr+yXZ/WmXsckHiKl12ar0y6XiXDx3m4RHn1w==", + "dev": true, + "requires": { + "path-parse": "^1.0.6" + } + }, + "shelljs": { + "version": "0.8.4", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", + "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "dev": true, + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + } + } +} diff --git a/publish/package.json b/publish/package.json new file mode 100644 index 00000000..21cb6f57 --- /dev/null +++ b/publish/package.json @@ -0,0 +1,17 @@ +{ + "name": "@robocorp/robocode-kernel", + "version": "1.0.0", + "description": "", + "main": "index.js", + "scripts": { + "build": "node ./scripts/build.js" + }, + "author": "Robocorp", + "license": "BSD-3-Clause", + "files": [ + "dist/**/*" + ], + "devDependencies": { + "shelljs": "^0.8.4" + } +} diff --git a/publish/scripts/build.js b/publish/scripts/build.js new file mode 100644 index 00000000..4a9cca72 --- /dev/null +++ b/publish/scripts/build.js @@ -0,0 +1,23 @@ +const path = require('path'); +const sh = require('shelljs'); + +sh.set('-e'); + +const srcPath = '../dist/'; +const dstPath = 'dist/'; + +if (!sh.test('-e', path.dirname(srcPath))) { + console.error(`${srcPath} not found`); + process.exit(-1); +} +const files = sh.ls(srcPath); +if (!files.length) { + console.error(`${srcPath} is empty`); + process.exit(-1); +} + +sh.rm('-rf', dstPath); +sh.mkdir(dstPath); + +console.log('copy files', files.map(x => x.toString())); +sh.cp('-R', srcPath, dstPath);