Skip to content

Commit

Permalink
build: setting up automated releases
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeal committed Jul 14, 2020
1 parent c08663e commit aaff427
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/mikeals-workflow.yml
@@ -0,0 +1,59 @@
on: [push, pull_request]
name: Build, Test and maybe Publish
jobs:
test:
name: Build & Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: ${{ matrix.node-version }}-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Build
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
- name: Test
if: ${{ matrix.node-version == '14.x' }}
run: npm test
- name: Test
if: ${{ matrix.node-version == '12.x' }}
run: npm run $(node -e "console.log(require('./package.json').scripts['test:v12'] ? 'test:v1
2' : 'test')")
publish:
name: Publish
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Use Node.js 14.x
uses: actions/setup-node@v1
with:
node-version: 14.x
- name: Cache node_modules
id: cache-modules
uses: actions/cache@v1
with:
path: node_modules
key: 14.x-${{ runner.OS }}-build-${{ hashFiles('package.json') }}
- name: Build
if: steps.cache-modules.outputs.cache-hit != 'true'
run: npm install
- name: Test
run: npm test

- name: Publish
uses: mikeal/merge-release@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
4 changes: 2 additions & 2 deletions package.json
@@ -1,13 +1,13 @@
{
"name": "estest",
"version": "10.0.0",
"version": "0.0.0-dev",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test:node": "node cli.js test/test-*.js",
"test:deno": "deno run --allow-read deno.js test/test-runner-concurrent.js",
"test": "standard && npm run test:node && npm run test:deno"
"test": "standard && npm run test:node"
},
"keywords": [],
"author": "Mikeal Rogers <mikeal.rogers@gmail.com> (https://www.mikealrogers.com/)",
Expand Down

0 comments on commit aaff427

Please sign in to comment.