Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit ae95874

Browse files
authored
chore: add auto-publish (#8)
1 parent 1139507 commit ae95874

File tree

3 files changed

+196
-31
lines changed

3 files changed

+196
-31
lines changed

.github/workflows/main.yml

Lines changed: 187 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: ci
1+
name: test & maybe release
22
on:
33
push:
44
branches:
@@ -8,45 +8,215 @@ on:
88
- master
99

1010
jobs:
11+
1112
check:
1213
runs-on: ubuntu-latest
1314
steps:
1415
- uses: actions/checkout@v2
15-
- run: npm install
16-
- run: npx aegir lint
17-
- uses: gozala/[email protected]
18-
- run: npx aegir build --no-bundle
19-
- run: npx aegir dep-check
16+
- uses: actions/setup-node@v2
17+
with:
18+
node-version: lts/*
19+
- uses: actions/cache@v2
20+
id: cache
21+
env:
22+
CACHE_NAME: cache-node-modules
23+
with:
24+
path: |
25+
~/.npm
26+
./dist
27+
./node_modules
28+
./packages/*/dist
29+
./packages/*/node_modules
30+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }}
31+
- name: Install Dependencies
32+
if: steps.cache.outputs.cache-hit != 'true'
33+
run: |
34+
npm install
35+
npm run --if-present build
36+
- run: npm run --if-present lint
37+
- run: npm run --if-present dep-check
38+
2039
test-node:
2140
needs: check
2241
runs-on: ${{ matrix.os }}
2342
strategy:
2443
matrix:
2544
os: [windows-latest, ubuntu-latest, macos-latest]
26-
node: [14, 16]
45+
node: [16]
2746
fail-fast: true
2847
steps:
2948
- uses: actions/checkout@v2
30-
- uses: actions/setup-node@v1
49+
- uses: actions/setup-node@v2
3150
with:
3251
node-version: ${{ matrix.node }}
33-
- run: npm install
34-
- run: npm run pretest
35-
- run: npx nyc --reporter=lcov aegir test -t node -- --bail
52+
- uses: actions/cache@v2
53+
id: cache
54+
env:
55+
CACHE_NAME: cache-node-modules
56+
with:
57+
path: |
58+
~/.npm
59+
./dist
60+
./node_modules
61+
./packages/*/dist
62+
./packages/*/node_modules
63+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }}
64+
- name: Install Dependencies
65+
if: steps.cache.outputs.cache-hit != 'true'
66+
run: |
67+
npm install
68+
npm run --if-present build
69+
- run: npm run --if-present test:node -- --bail --cov
3670
- uses: codecov/codecov-action@v1
71+
72+
test-chrome:
73+
needs: check
74+
runs-on: ubuntu-latest
75+
steps:
76+
- uses: actions/checkout@v2
77+
- uses: actions/setup-node@v2
78+
with:
79+
node-version: lts/*
80+
- uses: actions/cache@v2
81+
id: cache
82+
env:
83+
CACHE_NAME: cache-node-modules
84+
with:
85+
path: |
86+
~/.npm
87+
./dist
88+
./node_modules
89+
./packages/*/dist
90+
./packages/*/node_modules
91+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }}
92+
- name: Install Dependencies
93+
if: steps.cache.outputs.cache-hit != 'true'
94+
run: |
95+
npm install
96+
npm run --if-present build
97+
- run: npm run --if-present test:browser -- -t browser -t webworker --bail
98+
99+
test-firefox:
100+
needs: check
101+
runs-on: ubuntu-latest
102+
steps:
103+
- uses: actions/checkout@v2
104+
- uses: actions/setup-node@v2
105+
with:
106+
node-version: lts/*
107+
- uses: actions/cache@v2
108+
id: cache
109+
env:
110+
CACHE_NAME: cache-node-modules
111+
with:
112+
path: |
113+
~/.npm
114+
./dist
115+
./node_modules
116+
./packages/*/dist
117+
./packages/*/node_modules
118+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }}
119+
- name: Install Dependencies
120+
if: steps.cache.outputs.cache-hit != 'true'
121+
run: |
122+
npm install
123+
npm run --if-present build
124+
- run: npm run --if-present test:browser -- -t browser -t webworker --bail -- --browser firefox
125+
37126
test-electron-main:
38127
needs: check
39128
runs-on: ubuntu-latest
40129
steps:
41130
- uses: actions/checkout@v2
42-
- run: npm install
43-
- run: npm run pretest
44-
- run: npx xvfb-maybe aegir test -t electron-main --bail -f dist/cjs/node-test/*js
131+
- uses: actions/setup-node@v2
132+
with:
133+
node-version: lts/*
134+
- uses: actions/cache@v2
135+
id: cache
136+
env:
137+
CACHE_NAME: cache-node-modules
138+
with:
139+
path: |
140+
~/.npm
141+
./dist
142+
./node_modules
143+
./packages/*/dist
144+
./packages/*/node_modules
145+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }}
146+
- name: Install Dependencies
147+
if: steps.cache.outputs.cache-hit != 'true'
148+
run: |
149+
npm install
150+
npm run --if-present build
151+
- run: npx xvfb-maybe npm run --if-present test:electron-main -- --bail
152+
45153
test-electron-renderer:
46154
needs: check
47155
runs-on: ubuntu-latest
48156
steps:
49157
- uses: actions/checkout@v2
50-
- run: npm install
51-
- run: npm run pretest
52-
- run: npx xvfb-maybe aegir test -t electron-renderer --bail -f dist/cjs/browser-test/*js
158+
- uses: actions/setup-node@v2
159+
with:
160+
node-version: lts/*
161+
- uses: actions/cache@v2
162+
id: cache
163+
env:
164+
CACHE_NAME: cache-node-modules
165+
with:
166+
path: |
167+
~/.npm
168+
./dist
169+
./node_modules
170+
./packages/*/dist
171+
./packages/*/node_modules
172+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }}
173+
- name: Install Dependencies
174+
if: steps.cache.outputs.cache-hit != 'true'
175+
run: |
176+
npm install
177+
npm run --if-present build
178+
- run: npx xvfb-maybe npm run --if-present test:electron-renderer -- --bail
179+
180+
release:
181+
needs: [test-node, test-chrome, test-firefox, test-electron-main]
182+
runs-on: ubuntu-latest
183+
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && !contains(github.event.head_commit.author.name, 'Github Actions')
184+
steps:
185+
- uses: actions/[email protected]
186+
with:
187+
fetch-depth: 0
188+
- uses: actions/setup-node@v2
189+
with:
190+
node-version: lts/*
191+
- uses: actions/cache@v2
192+
id: cache
193+
env:
194+
CACHE_NAME: cache-node-modules
195+
with:
196+
path: |
197+
~/.npm
198+
./dist
199+
./node_modules
200+
./packages/*/dist
201+
./packages/*/node_modules
202+
key: ${{ runner.os }}-build-${{ env.CACHE_NAME }}-${{ github.sha }}
203+
- name: Install Dependencies
204+
if: steps.cache.outputs.cache-hit != 'true'
205+
run: |
206+
npm install
207+
npm run --if-present build
208+
- run: |
209+
git config --global user.email "[email protected]"
210+
git config --global user.name "Github Actions"
211+
if [[ -n "${NPM_TOKEN}" ]]; then
212+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
213+
fi
214+
if [[ -n "${DOCKER_TOKEN}" ]] && [[ -n "${DOCKER_USERNAME}" ]]; then
215+
echo "$DOCKER_TOKEN" | docker login -u "$DOCKER_USERNAME" --password-stdin
216+
fi
217+
npm run --if-present release
218+
env:
219+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
220+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
221+
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
222+
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}

README.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@
88

99
> Contains various implementations of the API contract described in [interface-blockstore](https://github.com/ipfs/js-ipfs-interfaces/tree/master/packages/interface-blockstore)
1010
11-
## Lead Maintainer <!-- omit in toc -->
12-
13-
[Alex Potsides](https://github.com/achingbrain)
14-
1511
## Table of Contents <!-- omit in toc -->
1612

1713
- [Implementations](#implementations)

package.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"name": "blockstore-core",
33
"version": "1.0.2",
44
"description": "Contains various implementations of the API contract described in interface-blockstore",
5-
"leadMaintainer": "Alex Potsides <[email protected]>",
65
"main": "src/index.js",
76
"type": "module",
87
"types": "types/src/index.d.ts",
@@ -20,6 +19,8 @@
2019
},
2120
"files": [
2221
"*",
22+
"!**/*/browser-test",
23+
"!**/*/node-test",
2324
"!**/*.tsbuildinfo"
2425
],
2526
"exports": {
@@ -46,12 +47,13 @@
4647
"clean": "rimraf dist types",
4748
"prepare": "aegir build --no-bundle && cp -R types dist",
4849
"lint": "aegir ts -p check && aegir lint",
49-
"build": "aegir build",
50-
"release": "aegir release --target node",
51-
"release-minor": "aegir release --type minor --target node",
52-
"release-major": "aegir release --type major --target node",
53-
"pretest": "aegir build --esm-tests",
50+
"build": "aegir build --esm-tests",
51+
"release": "semantic-release",
5452
"test": "aegir test",
53+
"test:node": "aegir test -t node",
54+
"test:browser": "aegir test -t browser",
55+
"test:electron-main": "aegir test -t electron-main -f dist/cjs/node-test/*js",
56+
"test:electron-renderer": "aegir test -t electron-renderer -f dist/cjs/node-test/*js",
5557
"dep-check": "aegir dep-check -i rimraf -i interface-blockstore -i interface-store -i aegir -i util"
5658
},
5759
"repository": {
@@ -85,8 +87,5 @@
8587
"it-filter": "^1.0.2",
8688
"it-take": "^1.0.1",
8789
"multiformats": "^9.4.7"
88-
},
89-
"contributors": [
90-
"achingbrain <[email protected]>"
91-
]
90+
}
9291
}

0 commit comments

Comments
 (0)