Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: Add automated release workflow #44

Merged
merged 1 commit into from
Oct 8, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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]+*'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe a short note about the release process in the readme would be useful: e.g. "to publish a new version of the package bump the version and push a v<version> tag."

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a simple release process doc, we'll improve it once we finish #12.


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
kostko marked this conversation as resolved.
Show resolved Hide resolved
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