Merge pull request #8 from seald/github-actions

GitHub actions
pull/10/head
tex0l 3 years ago committed by GitHub
commit b53f651b9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 38
      .github/workflows/github-actions-demo.yml
  2. 22
      .github/workflows/publish.yml
  3. 35
      .gitlab-ci.yml

@ -0,0 +1,38 @@
name: Tests
on: [push, pull_request]
jobs:
node-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
steps:
- uses: actions/checkout@v2
- name: Install Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm ci
- run: npm run lint
- run: npm run test
browser-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Node.js 14
uses: actions/setup-node@v2
with:
node-version: 14.x
cache: 'npm'
- name: Install Chrome Stable
uses: browser-actions/setup-chrome@latest
- run: npm ci
- run: npm run lint
- run: npm run test:browser

@ -0,0 +1,22 @@
name: Publish Package
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14.x'
registry-url: 'https://registry.npmjs.org'
- run: npm ci
- run: npm run prepublishOnly
- id: get_npm_label
run: if (npx semver ${{ github.event.release.tag_name }} --range '>0.0.0'); then echo ::set-output name=NPM_LABEL::latest; else echo ::set-output name=NPM_LABEL::beta; fi; # Using the fact that semver by default considers that pre-releases do not respect stable ranges
- run: npm publish --tag=${NPM_LABEL} --access public
env:
NPM_LABEL: ${{ steps.get_npm_label.outputs.NPM_LABEL }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

@ -1,35 +0,0 @@
stages:
- test
- test-browser
- deploy
image: node:14
before_script:
- echo "//registry.npmjs.org/:_authToken=${NPM_REGISTRY_TOKEN}" > .npmrc
- npm ci --cache .npm --prefer-offline
cache:
key: "nedb" # universal cache
paths:
- .npm/
test:
stage: test
script:
- npm run lint
- npm run test
test-browser:
image: nexus-docker.tardis.seald.io/seald/docker-browser-testing:CHROME_88
stage: test-browser
script: npm run test:browser
deploy:
stage: deploy
script:
- npm run prepublishOnly
- if (npx semver $CI_COMMIT_TAG --range '>0.0.0'); then NPM_TAG=latest; else NPM_TAG=beta; fi; # Using the fact that semver by default considers that pre-releases do not respect stable ranges
- npm publish --tag=$NPM_TAG --access public
only:
- tags
Loading…
Cancel
Save