Skip to content

Commit

Permalink
build: GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpeterparker committed Jan 10, 2024
1 parent cb6268c commit 300347a
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/actions/prepare/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Prepare

description: Checkout and install dependencies

runs:
using: composite
steps:
- uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- name: Install npm
shell: bash
run: npm install -g npm
- name: Install dependencies
shell: bash
run: npm ci
45 changes: 45 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Checks

on:
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
uses: ./.github/actions/prepare
- name: Build
run: npm run build

format:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
uses: ./.github/actions/prepare
- name: Lint
run: npm run format:check

lint:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Prepare
uses: ./.github/actions/prepare
- name: Lint
run: npm run lint

may-merge:
needs: ['format', 'lint', 'build']
runs-on: ubuntu-latest
steps:
- name: Cleared for merging
run: echo OK
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: [released]

jobs:
build:
runs-on: ubuntu-latest

permissions:
contents: read
id-token: write

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: npm install -g npm
- run: npm ci
- run: npm run build
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 300347a

Please sign in to comment.