Skip to content

Commit 16151fb

Browse files
committed
chore: add github action for release
1 parent 1a7d0d6 commit 16151fb

File tree

3 files changed

+71
-4
lines changed

3 files changed

+71
-4
lines changed

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI - cli
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- 'release/*'
8+
9+
jobs:
10+
lint-all:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v3
14+
- name: Use Node.js 16.x
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: 16.x
18+
cache: npm
19+
- run: node ./bin/npm-cli.js run resetdeps
20+
- run: node ./bin/npm-cli.js run lint-all
21+
22+
prepublish:
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v3
26+
- name: Use Node.js 16.x
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: 16.x
30+
cache: npm
31+
- run: make prepublish
32+
33+
test-all:
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
node-version:
38+
- 12.13.0
39+
- 12.x
40+
- 14.15.0
41+
- 14.x
42+
- 16.0.0
43+
- 16.x
44+
platform:
45+
- os: ubuntu-latest
46+
shell: bash
47+
- os: macos-latest
48+
shell: bash
49+
- os: windows-latest
50+
shell: cmd
51+
runs-on: ${{ matrix.platform.os }}
52+
defaults:
53+
run:
54+
shell: ${{ matrix.platform.shell }}
55+
steps:
56+
- uses: actions/checkout@v3
57+
- name: Use Node.js ${{ matrix.node-version }}
58+
uses: actions/setup-node@v3
59+
with:
60+
node-version: ${{ matrix.node-version }}
61+
cache: npm
62+
- run: node ./bin/npm-cli.js run resetdeps
63+
- run: node ./bin/npm-cli.js run test-all --ignore-scripts
64+
- name: git status
65+
if: matrix.platform.os != 'windows-latest'
66+
run: node scripts/git-dirty.js

Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,11 @@ link: uninstall
104104

105105
prune: deps
106106
node bin/npm-cli.js prune --production --no-save --no-audit
107-
@[[ "$(shell git status -s)" != "" ]] && echo "ERR: found unpruned files" && exit 1 || echo "git status is clean"
107+
node scripts/git-dirty.js
108108

109-
publish: gitclean ls-ok link test smoke-tests docs prune
110-
@git push origin :v$(shell node bin/npm-cli.js --no-timing -v) 2>&1 || true
109+
prepublish: gitclean ls-ok link test smoke-tests docs prune
110+
111+
publish: prepublish
111112
git push origin $(BRANCH) &&\
112113
git push origin --tags &&\
113114
node bin/npm-cli.js publish --tag=$(PUBLISHTAG)

scripts/git-dirty.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env node
22
const { spawnSync } = require('child_process')
3-
const changes = spawnSync('git', ['status', '--porcelain', '-uno'])
3+
const changes = spawnSync('git', ['status', '--porcelain', '-uall'])
44
const stdout = changes.stdout.toString('utf8')
55
const stderr = changes.stderr.toString('utf8')
66
const { status, signal } = changes

0 commit comments

Comments
 (0)