Skip to content

Commit

Permalink
ci: add release workflow & changesets (#25)
Browse files Browse the repository at this point in the history
* feat: add changesets

* ci: add Github release workflow & changeset

* ci: remove ignore "@wedges/eslint-config" in changeset
  • Loading branch information
brankoconjic committed Dec 20, 2023
1 parent 08358a3 commit 4c65893
Show file tree
Hide file tree
Showing 9 changed files with 737 additions and 27 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "lmsqueezy/wedges" }],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": ["@wedges/docs"]
}
12 changes: 12 additions & 0 deletions .github/changeset-version.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// ORIGINALLY FROM CLOUDFLARE WRANGLER:
// https://github.com/cloudflare/wrangler2/blob/main/.github/changeset-version.js

import { exec } from "child_process";

// This script is used by the `release.yml` workflow to update the version of the packages being released.
// The standard step is only to run `changeset version` but this does not update the package-lock.json file.
// So we also run `npm install`, which does this update.
// This is a workaround until this is handled automatically by `changeset version`.
// See https://github.com/changesets/changesets/issues/421.
exec("npx changeset version");
exec("pnpm install");
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Adapted from create-t3-app.

name: Release

on:
push:
branches:
- main

jobs:
release:
if: ${{ github.repository_owner == 'lmsqueezy' }}
name: Create a PR for release workflow
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use PNPM
uses: pnpm/action-setup@v2.4.0
with:
version: 8.11.0

- name: Cache PNPM modules # Caches the PNPM modules for faster builds
uses: actions/cache@v3
with:
path: ~/.pnpm-store
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Setup Node.js from .nvmrc # Dynamically sets up Node.js version
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "pnpm"

- name: Install NPM Dependencies
run: pnpm install

- name: Build the package
run: pnpm build

- name: Publish to NPM
id: changesets
uses: changesets/action@v1.4.5
with:
commit: "chore(release): version packages"
title: "chore(release): version packages"
version: node .github/changeset-version.js
publish: npx changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_ENV: "production"
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
18
2 changes: 1 addition & 1 deletion apps/docs/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "docs",
"name": "@wedges/docs",
"version": "0.1.0",
"private": true,
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
"lint:fix": "turbo run lint:fix",
"test": "NODE_OPTIONS='--experimental-vm-modules' jest --passWithNoTests",
"test:coverage": "NODE_OPTIONS='--experimental-vm-modules' jest --coverage --passWithNoTests",
"prepare": "husky install"
"prepare": "husky install",
"version": "changeset version",
"version:dev": "changeset version --snapshop --no-git-tag --tag dev",
"release": "pnpm build && changeset publish",
"release:dev": "pnpm build && changeset publish --snapshot --no-git-tag --tag dev"
},
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@commitlint/cli": "^18.4.3",
"@commitlint/config-conventional": "^18.4.3",
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
Expand Down
52 changes: 27 additions & 25 deletions packages/wedges/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@lmsqueezy/wedges",
"version": "0.0.0",
"description": "Beautiful UI components for React, crafted with the Wedges design system, Radix UI, and Tailwind CSS.",
"description": "An ever-expanding, open-source React UI library built with the Wedges Design System, Radix primitives, and Tailwind CSS.",
"keywords": [
"accessible",
"components",
Expand All @@ -10,13 +10,37 @@
"design",
"lemonsqueezy",
"library",
"premiumpixels",
"WAI-ARIA",
"dark",
"themes",
"radix",
"react",
"responsive",
"tailwindcss",
"ui"
],
"license": "MIT",
"author": {
"name": "Lemon Squeezy",
"email": "hello@lemonsqueezy.com",
"url": "https://lemonsqueezy.com/wedges"
},
"homepage": "https://lemonsqueezy.com/wedges",
"bugs": {
"url": "https://github.com/lmsqueezy/wedges/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/lmsqeezy/wedges.git",
"directory": "packages/wedges"
},
"publishConfig": {
"access": "public"
},
"files": [
"dist",
"README.md"
],
"type": "module",
"main": "./dist/cjs/index.js",
"types": "./dist/cjs/index.d.cts",
Expand All @@ -33,6 +57,7 @@
}
}
},
"sideEffects": false,
"scripts": {
"build:cjs": "tsup --format cjs --external react",
"build:esm": "tsup --format esm --external react",
Expand All @@ -45,29 +70,6 @@
"lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
"lint:fix": "eslint 'src/**/*.{js,jsx,ts,tsx}' --fix"
},
"author": {
"name": "Lemon Squeezy",
"email": "hello@lemonsqueezy.com",
"url": "https://lemonsqueezy.com/wedges"
},
"homepage": "https://lemonsqueezy.com/wedges",
"bugs": {
"url": "https://github.com/lmsqueezy/wedges/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lmsqeezy/wedges.git"
},
"private": false,
"publishConfig": {
"access": "public"
},
"files": [
"dist/**",
"README.md"
],
"sideEffects": false,
"license": "MIT",
"devDependencies": {
"@ianvs/prettier-plugin-sort-imports": "^4.1.1",
"@types/color": "^3.0.6",
Expand Down
Loading

0 comments on commit 4c65893

Please sign in to comment.