Skip to content

Commit

Permalink
ci: add release workflow (#14)
Browse files Browse the repository at this point in the history
Release-As: 0.0.8
  • Loading branch information
ocavue authored Aug 22, 2024
1 parent 5ada458 commit 5437a33
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 39 deletions.
31 changes: 31 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Setup
description: Shared setup for all actions

inputs:
node-version:
description: The version of node.js
required: false
default: "20"

runs:
using: composite
steps:
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 8

- name: Setup node
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
cache: pnpm
registry-url: "https://npm.pkg.github.com"

- name: Install dependencies
run: pnpm install
shell: bash

- name: Build
run: pnpm build
shell: bash
14 changes: 3 additions & 11 deletions .github/workflows/chromatic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,10 @@ jobs:
name: Run Chromatic
runs-on: ubuntu-latest
steps:
- name: Checkout code
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: pnpm/action-setup@v4
with:
version: 8
- name: Install dependencies
run: pnpm install
- name: Setup environment
uses: ./.github/actions/setup
- name: Build
run: pnpm build
- name: Run Chromatic
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Release

on:
push:
branches:
- main

jobs:
version:
runs-on: ubuntu-latest
steps:
- uses: googleapis/release-please-action@v4
id: release-please
with:
release-type: node
outputs:
release_created: ${{ steps.release-please.outputs.release_created }}

publish:
runs-on: ubuntu-latest
needs: [version]
if: ${{ needs.version.outputs.release_created }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup environment
uses: ./.github/actions/setup
- name: Build
run: pnpm build
- name: Publish to NPM
run: pnpm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
31 changes: 3 additions & 28 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,37 +14,12 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4

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

- uses: pnpm/action-setup@v3
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Setup environment
uses: ./.github/actions/setup
- name: Lint
run: pnpm run lint
- name: Test
run: pnpm run coverage
- name: 'Report Coverage'
- name: "Report Coverage"
if: always()
uses: davelosert/vitest-coverage-report-action@v2

0 comments on commit 5437a33

Please sign in to comment.