Skip to content

Commit

Permalink
OTHER: publish robocode-kernel to github packages
Browse files Browse the repository at this point in the history
  • Loading branch information
corker committed Oct 11, 2020
1 parent 9f44b85 commit cd70bf5
Show file tree
Hide file tree
Showing 6 changed files with 220 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/publish-jupyterlab_robotmode.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/publish-robocode-kernel.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 2 additions & 0 deletions publish/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
137 changes: 137 additions & 0 deletions publish/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions publish/package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
23 changes: 23 additions & 0 deletions publish/scripts/build.js
Original file line number Diff line number Diff line change
@@ -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);

0 comments on commit cd70bf5

Please sign in to comment.