Skip to content

Commit

Permalink
Setup GitHub actions workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jhnns committed Jan 27, 2022
1 parent 96b75a2 commit f2d9bf9
Show file tree
Hide file tree
Showing 3 changed files with 513 additions and 3 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/test-and-release.yml
@@ -0,0 +1,59 @@
name: πŸ§ͺ Test and πŸš€ Release

on:
push:
branches:
- main
- beta
pull_request: {}

jobs:
test-and-release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"

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

steps:
- name: πŸ›‘ Cancel Previous Runs
uses: styfle/cancel-workflow-action@a40b8845c0683271d9f53dfcb887a7e181d3918b # pin@0.9.1
- name: ⬇️ Checkout repo
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # pin@v2
- name: βŽ” Setup node ${{ matrix.node-version }}
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561 # pin@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: "https://npm.pkg.github.com"
cache: "npm"
- name: πŸ—„ Cache node_modules
id: cache-node_modules
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # pin@v2
with:
path: "**/node_modules"
key: node_modules-${{ runner.os }}-node-${{ matrix.node-version }}-${{
hashFiles('**/package-lock.json') }}
- name: πŸ—„ Cache .eslintcache
uses: actions/cache@937d24475381cd9c75ae6db12cb4e79714b926ed # pin@v2
with:
path: .eslintcache
key: eslintcache-${{ runner.os }}-node-${{ matrix.node-version }}-${{
hashFiles('**/package-lock.json') }}
- name: πŸ“₯ Install dependencies
if: steps.cache-node_modules.outputs.cache-hit != 'true'
run: |
npm ci --ignore-scripts
- name: πŸ§ͺ Test
run: |
npm test
env:
CI: true
- name: πŸš€ Release on GitHub
if: "contains(' refs/heads/main refs/heads/beta ', github.ref) &&
matrix.node-version == '16.x'"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
npm run release

0 comments on commit f2d9bf9

Please sign in to comment.