Skip to content

Commit

Permalink
ci(gha): add project workflows
Browse files Browse the repository at this point in the history
add test, docs, release, and format jobs
  • Loading branch information
web-mech committed Aug 17, 2024
1 parent 68b74fd commit 5cfb5f2
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 31 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Deploy Docs to Pages

on:
push:
branches: ['main']
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 20
- name: Install Dependencies
run: yarn install
- name: Build
run: |
yarn build
yarn typedoc
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload docs folder
path: 'docs'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
29 changes: 29 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Format

on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
lint-and-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v1
with:
node-version: 20
- run: yarn install
- run: |
yarn lint:fix
yarn prettier
- name: Create Lint PR
uses: peter-evans/[email protected]
with:
base: ${{ github.head_ref }}
commit-message: 'style: ESlint + Prettier Lint'
title: ESlint + Prettier Format
body: Format * to standard format.
branch: ${{ github.event.pull_request.head.ref }}-fmt
add-paths: |
src/*
31 changes: 0 additions & 31 deletions .github/workflows/node.js.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release

on:
push:
branches: ['main']

jobs:
publish-gpr:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v1
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: yarn global add standard-version
- run: git config --global user.email "[email protected]"
- run: git config --global user.name "GitHub Action"
- uses: EndBug/add-and-commit@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: standard-version
- run: git push --follow-tags origin main && npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
24 changes: 24 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Run the tests

on:
pull_request:
branches: ['main']

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x, 20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install NPM Dependencies
run: yarn install
- run: yarn test

0 comments on commit 5cfb5f2

Please sign in to comment.