mirror of
https://github.com/wickedest/Mergely.git
synced 2026-02-02 09:38:00 +08:00
chore(ci): added workflows
This commit is contained in:
46
.github/workflows/npm-publish.yaml
vendored
Normal file
46
.github/workflows/npm-publish.yaml
vendored
Normal file
@@ -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
.github/workflows/npm-release.yaml
vendored
Normal file
34
.github/workflows/npm-release.yaml
vendored
Normal file
@@ -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
.github/workflows/run-tests.yaml
vendored
Normal file
41
.github/workflows/run-tests.yaml
vendored
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user