Skip to content

Commit

Permalink
chore(ci): added workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamie Peabody committed Nov 21, 2021
1 parent 623a93b commit addc610
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 0 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/npm-publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Publish to npm

on:
workflow_dispatch:
inputs:
tag:
description: 'NPM Tag'
required: false
default: 'next'

jobs:
tag-and-publish:
runs-on: ubuntu-latest

steps:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 10
registry-url: https://registry.npmjs.org

- name: Git checkout
uses: actions/checkout@v2

- name: Install dependencies
run: npm install
env:
CI: true

- name: Get package version
run: |
export VERSION=`cat package.json | grep version | sed -E 's/.*: "(.*)",/\1/'`
echo "DIST_TAG=v$VERSION" >> $GITHUB_ENV
- name: Build
run: npm test

- name: Tag repo with $DIST_TAG
run: |
git tag $DIST_TAG
git push origin $DIST_TAG
- name: Publish to npm with dist-tag next
run: npm publish --access public --tag ${{ github.event.inputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
34 changes: 34 additions & 0 deletions .github/workflows/npm-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Release latest on npm

on:
workflow_dispatch:
inputs:

jobs:
tag-and-publish:
runs-on: ubuntu-latest

steps:
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: 10
registry-url: https://registry.npmjs.org

- name: Git checkout
uses: actions/checkout@v2

- name: Get package version
run: |
export VERSION=`cat package.json | grep version | sed -E 's/.*: "(.*)",/\1/'`
echo "PKG_VERSION=$VERSION" >> $GITHUB_ENV
- name: Update dist-tag
run: npm dist-tag add mergely@${PKG_VERSION} latest
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Remove 'next' dist-tag
run: npm dist-tag rm mergely next
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
41 changes: 41 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Run tests

# on: [push, pull_request]

on:
push:
branches-ignore:
- 'master'
tags-ignore:
- 'v*'

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x] #, 12.x, 14.x, 15.x

name: Node.js ${{ matrix.node-version }}

steps:
- name: Git checkout
uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install
env:
CI: true

- name: Test
run: npm run test

- name: Build
run: npm run build:dist

0 comments on commit addc610

Please sign in to comment.