Skip to content

Commit

Permalink
Merge pull request #44 from oasisprotocol/kostko/feature/release
Browse files Browse the repository at this point in the history
ci: Add automated release workflow
  • Loading branch information
kostko authored Oct 8, 2020
2 parents befebfd + d342f68 commit 5132130
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 2 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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
Empty file removed .npmignore
Empty file.
32 changes: 32 additions & 0 deletions docs/release-process.md
Original file line number Diff line number Diff line change
@@ -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<VERSION>` 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
10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 5132130

Please sign in to comment.