Skip to content

Commit

Permalink
ci: setup CI
Browse files Browse the repository at this point in the history
  • Loading branch information
Lordfirespeed committed Aug 25, 2024
1 parent 5e091a9 commit 690a676
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 27 deletions.
18 changes: 18 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: 'Setup'
description: 'Prepares a local copy of the repository for CI actions'
runs:
using: composite
steps:
- name: Enable corepack
shell: bash
run: corepack enable pnpm

- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
cache: 'pnpm'

- name: Install dependencies
shell: bash
run: pnpm install
27 changes: 0 additions & 27 deletions .github/workflows/ci.yml

This file was deleted.

48 changes: 48 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
environment: ci
steps:
- uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- run: pnpm test:coverage

- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage/lcov.info

check:
runs-on: ubuntu-latest
environment: ci
steps:
- uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- run: pnpm check
- run: pnpm type-check

build:
runs-on: ubuntu-latest
environment: ci
steps:
- uses: actions/checkout@v4

- name: Setup
uses: ./.github/actions/setup

- run: pnpm build
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish

on:
release:
types: [prereleased, released]

jobs:
publish:
name: Publish to NPM
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
filter: tree:0

- name: Setup
uses: ./.github/actions/setup

- run: git config --global user.name "${{ github.actor }}"
- run: git config --global user.email "github-action-${{ github.actor }}@users.noreply.github.com"
- run: npm version from-git --no-git-tag-version
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

0 comments on commit 690a676

Please sign in to comment.