Skip to content

Commit

Permalink
chore: add github action for release
Browse files Browse the repository at this point in the history
  • Loading branch information
lukekarrys committed Apr 1, 2022
1 parent 1a7d0d6 commit e2fa064
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 4 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Release - cli

on:
workflow_dispatch:
pull_request:
branches:
- 'release/*'

jobs:
lint-all:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- run: node ./bin/npm-cli.js run resetdeps
- run: node ./bin/npm-cli.js run lint-all

prepublish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
cache: npm
- run: make prepublish

test-all:
strategy:
fail-fast: false
matrix:
node-version:
- 12.13.0
- 12.x
- 14.15.0
- 14.x
- 16.0.0
- 16.x
platform:
- os: ubuntu-latest
shell: bash
- os: macos-latest
shell: bash
- os: windows-latest
shell: cmd
runs-on: ${{ matrix.platform.os }}
defaults:
run:
shell: ${{ matrix.platform.shell }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: node ./bin/npm-cli.js run resetdeps
- run: node ./bin/npm-cli.js run test-all --ignore-scripts
- name: git status
if: matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,11 @@ link: uninstall

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

publish: gitclean ls-ok link test smoke-tests docs prune
@git push origin :v$(shell node bin/npm-cli.js --no-timing -v) 2>&1 || true
prepublish: gitclean ls-ok link test smoke-tests docs prune

publish: prepublish
git push origin $(BRANCH) &&\
git push origin --tags &&\
node bin/npm-cli.js publish --tag=$(PUBLISHTAG)
Expand Down
2 changes: 1 addition & 1 deletion scripts/git-dirty.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env node
const { spawnSync } = require('child_process')
const changes = spawnSync('git', ['status', '--porcelain', '-uno'])
const changes = spawnSync('git', ['status', '--porcelain', '-uall'])
const stdout = changes.stdout.toString('utf8')
const stderr = changes.stderr.toString('utf8')
const { status, signal } = changes
Expand Down

0 comments on commit e2fa064

Please sign in to comment.