Skip to content

Commit

Permalink
[ksc-release-4.1] ci: add changesets (kubesphere#4266)
Browse files Browse the repository at this point in the history
* ci: add changesets

Signed-off-by: donniean <[email protected]>

* ci: add changesets ci

Signed-off-by: donniean <[email protected]>

* chore: update package.json

Signed-off-by: donniean <[email protected]>

* ci: update changesets

Signed-off-by: donniean <[email protected]>

* ci: add snapshot actions

Signed-off-by: donniean <[email protected]>

---------

Signed-off-by: donniean <[email protected]>
Co-authored-by: donniean <[email protected]>
  • Loading branch information
ks-ci-bot and donniean authored Jul 15, 2024
1 parent 71937c8 commit 57a79c6
Show file tree
Hide file tree
Showing 7 changed files with 538 additions and 7 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)
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [["@ks-console/*"]],
"linked": [],
"access": "public",
"baseBranch": "ksc",
"updateInternalDependencies": "patch",
"ignore": ["extensions/*"],
"snapshot": {
"useCalculatedVersion": true
}
}
37 changes: 37 additions & 0 deletions .github/workflows/release-packages-snapshot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release Packages

on:
push:
branches:
- ksc-next
- ksc-next-*
- ksc-next/*

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release-packages:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16

- name: Install Dependencies
run: yarn

- name: Build Packages
run: yarn build:packages

- name: Generate changeset
run: yarn changeset version --snapshot next

- name: Publish
run: yarn changeset publish --no-git-tag --tag next
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
36 changes: 36 additions & 0 deletions .github/workflows/release-packages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Release Packages

on:
push:
branches:
- ksc

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release-packages:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 16

- name: Install Dependencies
run: yarn

- name: Build Packages
run: yarn build:packages

- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: yarn release:packages
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@
"build:packages": "esno scripts/build-packages.js",
"build:prod": "cross-env dll=true ksc build:prod -s true",
"build:server": "NODE_ENV=production webpack --config scripts/webpack.server.js --stats errors-only",
"changeset:add": "changeset add",
"clean": "rimraf packages/*/{esm,cjs,lib,dist} packages/**/*.tsbuildinfo locales/dist dist **/.DS_Store",
"create:ext": "ksc create:ext",
"dev": "concurrently -k --raw 'yarn dev:client' 'yarn dev:server'",
"dev:client": "NODE_ENV=development ksc dev -s true",
"dev:server": "NODE_ENV=development ksc-server",
"publish:packages:local": "yarn clean && yarn build:locales && yarn build:server && yarn build:packages && esno scripts/publish-packages.local.ts",
"release:packages": "changeset version && changeset publish",
"release:packages:local": "yarn clean && yarn build:locales && yarn build:server && yarn build:packages && esno scripts/publish-packages.local.ts",
"release:packages:snapshot": "bash scripts/release.packages.snapshot.sh",
"serve": "NODE_ENV=production node server/server.js"
},
"browserslist": ["> 1%", "last 2 versions", "not ie <= 8"],
Expand Down Expand Up @@ -75,6 +78,7 @@
"@babel/preset-env": "^7.15.8",
"@babel/preset-react": "^7.14.5",
"@babel/runtime": "^7.15.4",
"@changesets/cli": "^2.27.7",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
"@rollup/plugin-commonjs": "^22.0.0",
"@rollup/plugin-json": "^6.0.0",
Expand Down
11 changes: 11 additions & 0 deletions scripts/release.packages.snapshot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

TAG=$1

if [ -z "$TAG" ]; then
echo "Error: No tag provided. Usage: yarn run release:packages:snapshot -- <tag>"
exit 1
fi

changeset version --snapshot "$TAG" &&
changeset publish --no-git-tag --tag "$TAG"
Loading

0 comments on commit 57a79c6

Please sign in to comment.