Skip to content

Commit

Permalink
Refactor lint-and-test.yml and release.yml workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewmolyuk committed Apr 6, 2024
1 parent 3dac735 commit d9a0e36
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 28 deletions.
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: CI

# Trigger the workflow on push or pull request commits only
on:
push:
branches:
- master
tags-ignore:
- '**'
pull_request:
workflow_dispatch:

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm ci

- name: Lint code
run: make lint

test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20

- name: Install dependencies
run: npm ci

- name: Run tests
run: make test
22 changes: 0 additions & 22 deletions .github/workflows/lint-and-test.yml

This file was deleted.

17 changes: 11 additions & 6 deletions .github/workflows/release.yml → .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release
name: Publish package

# Trigger the build on release manually
on: workflow_dispatch
Expand All @@ -7,20 +7,25 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- run: npm ci
- run: make lint
- run: make test

- name: Install dependencies
run: npm ci

- name: Bump version and push tag
id: bump-version
uses: anothrNick/github-tag-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCHES: master
DEFAULT_BUMP: patch

- name: Publish new version to npm
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
Expand Down

0 comments on commit d9a0e36

Please sign in to comment.