Skip to content

Commit ecd7966

Browse files
author
Diego Rodríguez Baquero
committed
fix: add semantic release, switch CI
1 parent 2a21523 commit ecd7966

File tree

8 files changed

+67
-12
lines changed

8 files changed

+67
-12
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: ci
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Node ${{ matrix.node }} / ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
os:
13+
- ubuntu-latest
14+
node:
15+
- '14'
16+
steps:
17+
- uses: actions/checkout@v2
18+
- uses: actions/setup-node@v2
19+
with:
20+
node-version: ${{ matrix.node }}
21+
- run: npm install
22+
- run: npm run build --if-present
23+
- run: npm test

.github/workflows/release.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
release:
10+
name: Release
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
with:
16+
persist-credentials: false
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: 14
21+
- name: Cache
22+
uses: actions/cache@v2
23+
with:
24+
path: ~/.npm
25+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package.json') }}
26+
restore-keys: |
27+
${{ runner.os }}-npm-
28+
- name: Install dependencies
29+
run: npm i
30+
env:
31+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
32+
- name: Release
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
35+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36+
run: npx semantic-release

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
package-lock.json

.npmignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
.travis.yml
21
test/

.travis.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
# bittorrent-peerid [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
1+
# bittorrent-peerid [![ci][ci-image]][ci-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]
22

3-
[travis-image]: https://img.shields.io/travis/webtorrent/bittorrent-peerid/master.svg
4-
[travis-url]: https://travis-ci.org/webtorrent/bittorrent-peerid
3+
[ci-image]: https://github.com/webtorrent/bittorrent-peerid/actions/workflows/ci.yml/badge.svg
4+
[ci-url]: https://github.com/webtorrent/bittorrent-peerid/actions/workflows/ci.yml
55
[npm-image]: https://img.shields.io/npm/v/bittorrent-peerid.svg
66
[npm-url]: https://npmjs.org/package/bittorrent-peerid
77
[downloads-image]: https://img.shields.io/npm/dm/bittorrent-peerid.svg

lib/utils.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,7 @@ module.exports = {
1414
*
1515
* KTorrent 3 appears to use a dash rather than a final character.
1616
*/
17-
if (peerId.substring(1, 3) === 'FG') return true
18-
if (peerId.substring(1, 3) === 'LH') return true
19-
if (peerId.substring(1, 3) === 'NE') return true
20-
if (peerId.substring(1, 3) === 'KT') return true
21-
if (peerId.substring(1, 3) === 'SP') return true
17+
if (['FG', 'LH', 'NE', 'KT', 'SP'].includes(peerId.substring(1, 3))) return true
2218

2319
return false
2420
},

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
},
1313
"dependencies": {},
1414
"devDependencies": {
15+
"@webtorrent/semantic-release-config": "1.0.5",
16+
"semantic-release": "17.4.4",
1517
"standard": "*",
1618
"tape": "5.2.2"
1719
},

0 commit comments

Comments
 (0)