Skip to content

Commit

Permalink
Add release workflow (#387)
Browse files Browse the repository at this point in the history
  • Loading branch information
paescuj authored Dec 28, 2022
1 parent ed3c18f commit a6fc612
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 6 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
gh-release:
name: Create GitHub Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release create "$GITHUB_REF_NAME" --generate-notes

publish-npm:
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org

- name: Setup NPM cache
uses: ./.github/actions/setup-npm-cache

- name: Install dependencies
run: npm ci

- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish
6 changes: 1 addition & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ Please fix them and then run the commit command again.

## Test

Tests can be run with the command:
Tests can be executed with the following command:

```bash
npm test
```

## Release

Use [np](https://www.npmjs.com/package/np) to create a new release.
50 changes: 50 additions & 0 deletions package-lock.json

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

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"format:fix": "npm run format -- --write",
"lint": "eslint --ignore-path .gitignore --ext mjs,js,ts .",
"lint:fix": "npm run lint -- --fix",
"prepublishOnly": "npm run build",
"prepublishOnly": "safe-publish-latest && npm run build",
"report-coverage": "cat coverage/lcov.info | coveralls",
"test": "jest"
},
Expand Down Expand Up @@ -84,6 +84,7 @@
"jest-create-mock-instance": "^2.0.0",
"lint-staged": "^13.0.4",
"prettier": "^2.6.2",
"safe-publish-latest": "^2.0.0",
"simple-git-hooks": "^2.7.0",
"string-argv": "^0.3.1",
"typescript": "~4.9.3"
Expand Down

0 comments on commit a6fc612

Please sign in to comment.