From a9c6f35686b0728a725cb88fe8a778f4ea1ee01e Mon Sep 17 00:00:00 2001 From: Vojtech Miksu Date: Wed, 20 Dec 2023 13:46:55 -0800 Subject: [PATCH] Add publish workflow (#5325) --- .babelrc.js | 52 - .github/workflows/release.yml | 56 + .../components/header-navigation.jsx | 8 +- .../pages/components/layout-grid.mdx | 4 - .../pages/components/tabs-motion.mdx | 2 +- .../pages/getting-started/learn.mdx | 2 +- documentation-site/pages/guides/theming.mdx | 2 +- documentation-site/pages/index.jsx | 2 +- package.json | 10 +- pnpm-lock.yaml | 1262 ++++++++++++++++- publish/.babelrc.js | 26 + publish/publish-next.js | 19 + tsconfig.dist.json | 19 + tsconfig.json | 7 +- 14 files changed, 1326 insertions(+), 145 deletions(-) delete mode 100644 .babelrc.js create mode 100644 .github/workflows/release.yml create mode 100644 publish/.babelrc.js create mode 100755 publish/publish-next.js create mode 100644 tsconfig.dist.json diff --git a/.babelrc.js b/.babelrc.js deleted file mode 100644 index 38ee9cfccb..0000000000 --- a/.babelrc.js +++ /dev/null @@ -1,52 +0,0 @@ -let defaultPresets; - -if (process.env.BABEL_ENV === "es") { - defaultPresets = []; -} else { - defaultPresets = [ - [ - "@babel/preset-env", - { - modules: - process.env.BABEL_ENV === "esm" - ? false - : "commonjs", - targets: { - ie: "11", - }, - }, - ], - ]; -} - -module.exports = { - presets: [ - ...defaultPresets, - "@babel/react", - "@babel/preset-typescript", - ], - plugins: [ - "./publish/transform-cup-globals.js", - [ - "babel-plugin-transform-styletron-display-name", - { importSources: "any" }, - ], - "@babel/plugin-proposal-export-default-from", - "@babel/plugin-proposal-class-properties", - [ - "@babel/plugin-transform-runtime", - { - corejs: false, - helpers: false, - regenerator: true, - useESModules: false, - }, - ], - ], - env: { - test: { - plugins: [["./publish/transform-cup-globals.js"]], - }, - }, - ignore: ["./publish/transform-cup-globals.js"], -}; diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..6dba17ffcc --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release + +on: + push: + branches: + - main + +concurrency: ${{ github.workflow }}-${{ github.ref }} + +jobs: + release: + name: Release + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + id-token: write + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits + fetch-depth: 0 + + - uses: pnpm/action-setup@v2.2.4 + with: + version: 8.7.1 + + - name: Setup Node.js environment + uses: actions/setup-node@v3 + with: + node-version: 20.5 + cache: "pnpm" + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build library + run: pnpm build:lib + + - name: Build d.ts files + run: pnpm build:lib:dts + + - name: Creating .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + email=vojtech@miksu.cz + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publishing next version + run: ./publish/publish-next.js + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/documentation-site/components/header-navigation.jsx b/documentation-site/components/header-navigation.jsx index a0f0c62660..e0b080e429 100644 --- a/documentation-site/components/header-navigation.jsx +++ b/documentation-site/components/header-navigation.jsx @@ -8,7 +8,7 @@ LICENSE file in the root directory of this source tree. import * as React from "react"; import Link from "next/link"; -import Image from 'next/image'; +import Image from "next/image"; import { themedUseStyletron as useStyletron } from "../pages/_app"; import Menu from "baseui/icon/menu"; import DarkLogo from "../images/base-web.svg"; @@ -74,7 +74,8 @@ export default function HeaderNavigation({ outline: `3px solid ${theme.colors.accent}`, outlineOffset: "5px", }, - })}> + })} + > {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */} - {/* Version Selector */}
{/* Link to component gallery */} - +