Skip to content

Commit

Permalink
Better gha automation
Browse files Browse the repository at this point in the history
  • Loading branch information
salimkayabasi committed Feb 16, 2021
1 parent 00e63d7 commit 55d86f2
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 23 deletions.
70 changes: 47 additions & 23 deletions .github/workflows/node.yml
@@ -1,43 +1,67 @@
name: Build & Test & Deploy
name: CI

on: push
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
check_deploy:
cancel:
runs-on: ubuntu-latest
name: Cancel previous jobs
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.7.0
with:
access_token: ${{ github.token }}
lint:
name: Lint
runs-on: ubuntu-latest
needs:
- cancel
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
- name: Setup Node version
uses: actions/setup-node@v2.1.4
- name: Install Packages
run: npm ci
- name: Lint Files
run: npm run lint
test:
name: Test
timeout-minutes: 5
runs-on: ${{ matrix.os }}
needs:
- lint
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
node_version:
- 10
- 12
- 14
architecture:
- x64
# an extra windows-x86 run:
include:
- os: windows-2016
node_version: 12
architecture: x86
node:
- '15'
- '14'
- '12'
- '10'
runs-on: ${{ matrix.os }}
steps:
# Prepare
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node version
uses: actions/setup-node@v2.1.4
with:
node-version: ${{ matrix.node_version }}
architecture: ${{ matrix.architecture }}
# Fetch dependencies
node-version: ${{ matrix.node }}
- name: Node version
run: node -v && npm -v
- name: Fetch dependencies
run: npm ci
# Linters
- name: Linting
run: npm run lint
# Testing
if: ${{ !startswith(matrix.node, '15') }}
- name: Fetch dependencies
run: npm ci --legacy-peer-deps
if: ${{ startswith(matrix.node, '15') }}
- name: Testing
run: npm run test
23 changes: 23 additions & 0 deletions .github/workflows/release.yml
@@ -0,0 +1,23 @@
name: Release
on:
push:
branches:
- main
jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.3.4
with:
fetch-depth: 0
- name: Setup Node version
uses: actions/setup-node@v2.1.4
- name: Install dependencies
run: npm ci
- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release

0 comments on commit 55d86f2

Please sign in to comment.