Skip to content

Commit

Permalink
fix: github ci and publish workflows (#511)
Browse files Browse the repository at this point in the history
  • Loading branch information
ppvg authored Apr 3, 2024
1 parent d5e63d0 commit 0af457f
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 105 deletions.
36 changes: 36 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Setup
description: 'Setup Node.js and pnpm and install dependencies'

runs:
using: 'composite'
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'

- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 8

- 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: Audit dependencies
shell: bash
run: pnpm audit

- name: Install dependencies
shell: bash
run: pnpm install --ignore-scripts
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI

on:
push:
pull_request:
branches: [main]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Lint SCSS
run: pnpm run lint

check-formatting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Check formatting
run: pnpm run format:check

build-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Build Docs
run: pnpm run build
73 changes: 0 additions & 73 deletions .github/workflows/npm.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish package to npmjs
name: Publish package to npmjs and GitHub Packages

on:
push:
Expand All @@ -9,21 +9,10 @@ jobs:
publish-npm:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://registry.npmjs.org'

- run: |
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Get semver from tag
run: |
RELEASE_VERSION=${GITHUB_REF#refs/*/}
NPM_TAG=$(echo ${RELEASE_VERSION} | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?')
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
Expand All @@ -41,21 +30,10 @@ jobs:
publish-github:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: 8

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: 'https://npm.pkg.github.com'

- run: |
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Get semver from tag
run: |
RELEASE_VERSION=${GITHUB_REF#refs/*/}
NPM_TAG=$(echo ${RELEASE_VERSION} | grep -oP '^v\d+\.\d+\.\d+-?\K(\w+)?')
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> $GITHUB_ENV
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"pnpm": "^8.0.0"
},
"scripts": {
"dev": "pnpm run --dir docs dev"
"dev": "pnpm run --dir docs dev",
"build": "pnpm run --dir docs build",
"lint": "pnpm run --dir manon lint:css",
"format:check": "pnpm run --dir manon format:check"
}
}

0 comments on commit 0af457f

Please sign in to comment.