diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..0dae9968 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,50 @@ +# NOTE: This name appears in GitHub's Checks API and in workflow's status badge. +name: release + +# Trigger the workflow when: +on: + # A push occurs to one of the matched tags. + push: + tags: + # Pattern that roughly matches Ledger JS' version tags. + # For more details on GitHub Actions' pattern match syntax, see: + # https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions#patterns-to-match-branches-and-tags. + - 'v[0-9]+.[0-9]+*' + +jobs: + + prepare-release: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + # Check out pull request's HEAD commit instead of the merge commit to + # work-around an issue where a wrong commit is being checked out. + # For more details, see: + # https://github.com/actions/checkout/issues/299. + ref: ${{ github.event.pull_request.head.sha }} + + - name: Install needed system packages + run: | + sudo apt-get update -y + sudo apt-get install -y libusb-1.0.0 libudev-dev + + - name: Set up Node.js 12 + uses: actions/setup-node@v2.1.2 + with: + node-version: '12' + registry-url: https://registry.npmjs.org + + - name: Build code + run: | + yarn install + yarn build + + - name: Publish release on NPM + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + run: | + yarn publish \ + --tag latest \ + --access public diff --git a/.npmignore b/.npmignore deleted file mode 100644 index e69de29b..00000000 diff --git a/docs/release-process.md b/docs/release-process.md new file mode 100644 index 00000000..0ba1ac29 --- /dev/null +++ b/docs/release-process.md @@ -0,0 +1,32 @@ +# Release Process + +The following steps should be followed when preparing a release. + +## Preparing a Regular Release + +### Bump `package.json` Version + +Before a release, make sure that you have bumped the `version` field in +`package.json` to the new version. + +### Tag Next Release + +Create a new signed git tag from the latest commit in origin remote's `master` +branch. The tag should be called `v` where `VERSION` corresponds to +the `version` field in `package.json`. + +_TODO: Add Makefile target to make this easier._ + +### Ensure npm Release Was Published + +After the tag with the next release is pushed to the [canonical git repository], +the GitHub Actions [Release manager workflow] is triggered which uses the +[yarn] tool to automatically build packages and publish the new release in the +npm registry. + +Browse to [the npm registry] and make sure the new release is properly +published. + +[canonical git repository]: https://github.com/oasisprotocol/ledger-js +[Release manager workflow]: ../.github/workflows/release.yml +[the npm registry]: https://www.npmjs.com/package/@oasisprotocol/ledger diff --git a/package.json b/package.json index a05da762..3b4c5ff1 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,15 @@ { "name": "@oasisprotocol/ledger", - "version": "0.0.0", + "version": "0.1.0", "description": "Javascript / Node API for Oasis apps running on Ledger Nano S/X", "main": "./dist/index.js", "types": "./dist/index.d.ts", + "files": [ + "/dist", + "/docs", + "/LICENSE", + "/README.md" + ], "repository": { "type": "git", "url": "git+https://github.com/oasisprotocol/ledger-js.git" @@ -13,7 +19,7 @@ "Javascript", "Oasis" ], - "author": "ZondaX GmbH", + "author": "Oasis Protocol Foundation", "license": "Apache-2.0", "bugs": { "url": "https://github.com/oasisprotocol/ledger-js/issues"