Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve build and publish workflow #250

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Setup workflow
description: Manages general configurations for all workflows
runs:
using: composite
steps:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 16

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

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- name: Setup pnpm cache
uses: actions/cache@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
shell: bash
run: pnpm install
69 changes: 0 additions & 69 deletions .github/workflows/build.yaml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/check-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pull request checks
on:
pull_request:

jobs:
commit-lint:
name: Commit Lint
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
steps:
- name: Get repository
uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Enforce commit conventions (commitlint)
run: pnpm dlx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
50 changes: 50 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI
on:
push:
branches-ignore:
- master
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Get repository
uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Run tests
run: pnpm -r test

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Get repository
uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Run lint
run: pnpm -r lint

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Get repository
uses: actions/checkout@v3
with:
fetch-depth: 0

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

- name: Run build
run: pnpm -r build
33 changes: 33 additions & 0 deletions .github/workflows/on-push-main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: release-please

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
with:
release-type: node
path: packages/radix-vue

# - name: Get repository
# if: ${{ steps.release.outputs.release_created }}
# uses: actions/checkout@v3
# with:
# fetch-depth: 0
#
# - name: Setup
# if: ${{ steps.release.outputs.release_created }}
# uses: ./.github/actions/setup
#
# - name: Publish
# if: ${{ steps.release.outputs.release_created }}
# run: pnpm publish
47 changes: 47 additions & 0 deletions commitlint.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import {RuleConfigSeverity, UserConfig} from "@commitlint/types";

const Configuration: UserConfig = {
extends: ['@commitlint/config-conventional'],
rules: {
"scope-case": [RuleConfigSeverity.Error, "always", "camel-case"],
"scope-enum": [
RuleConfigSeverity.Error,
"always",
[
"accordion",
"alertDialog",
"aspectRatio",
"avatar",
"checkbox",
"collapsible",
"contextMenu",
"dialog",
"dropdownMenu",
"hoverCard",
"label",
"menubar",
"navigationMenu",
"popover",
"popper",
"presence",
"primitive",
"progress",
"radioGroup",
"scrollArea",
"select",
"separator",
"shared",
"slider",
"switch",
"tabs",
"toggle",
"toggleGroup",
"toolbar",
"tooltip",
"visuallyHidden",
]
]
}
}

module.exports = Configuration;
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@
"story:dev": "pnpm --filter histoire story:dev",
"build": "pnpm run -r --filter=!docs build",
"start": "cd packages/radix-vue && pnpm i && pnpm run build && cd ../../playground/vue3 && pnpm i && pnpm i ../../packages/radix-vue && pnpm run dev"
},
"devDependencies": {
"@commitlint/cli": "^17.6.7",
"@commitlint/config-conventional": "^17.6.7",
"@commitlint/types": "^17.4.4"
}
}
3 changes: 2 additions & 1 deletion packages/radix-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"type-check": "vue-tsc -p tsconfig.check.json --noEmit",
"type-gen": "vue-tsc --declaration --emitDeclarationOnly",
"format": "prettier --write \"**/*.{js,jsx,ts,tsx,css,md,vue}\" --ignore-path .gitignore",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --ignore-path .gitignore",
"lint:fix": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"test": "vitest"
},
"devDependencies": {
Expand Down
Loading