Skip to content

Commit

Permalink
feat: add registry release flow and update workflows (#6565)
Browse files Browse the repository at this point in the history
Co-authored-by: Ali Emir Şen <[email protected]>
  • Loading branch information
BatuhanW and aliemir authored Dec 11, 2024
1 parent 4a3ac19 commit 499c561
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "refinedev/refine" }],
"changelog": ["./format.js", { "repo": "refinedev/refine" }],
"commit": false,
"fixed": [],
"linked": [],
Expand Down
40 changes: 40 additions & 0 deletions .changeset/format.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
const clgh = require("@changesets/changelog-github");

const changelogFunctions = {
getDependencyReleaseLine: clgh.default.getDependencyReleaseLine,
getReleaseLine: async (changeset, tag, options) => {
const defaultChangeset = await clgh.default.getReleaseLine(
changeset,
tag,
options,
);

const isValid = ["community", "enterprise"].includes(
process.env.REFINE_RELEASE_TYPE,
);

if (!isValid) {
console.error(
"❌ REFINE_RELEASE_TYPE must be either community or enterprise",
);

process.exit(1);
}

let title = "";

if (process.env.REFINE_RELEASE_TYPE === "community") {
title = "\n\n📢 **Refine Community Release** 📢";
}

if (process.env.REFINE_RELEASE_TYPE === "enterprise") {
title = "\n\n⚡ **Refine Enterprise Release** ⚡";
}

const result = title + defaultChangeset;

return result;
},
};

exports.default = changelogFunctions;
23 changes: 23 additions & 0 deletions .cursorignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.biome/
.codesandbox/
.husky/
.vscode/
cypress/
documentation/
examples/
hackathon/
patches/
pnpm-lock.yaml
CHANGELOG.md
CODE_OF_CONDUCT.md
CONTRIBUTING.md
LICENSE
README.md
SECURITY.md
*.md
packages/**/tsconfig.json
packages/**/tsconfig.test.json
packages/**/tsconfig.declarations.json
packages/**/jest.config.js
packages/**/refine.config.js
packages/**/tsup.config.ts
19 changes: 12 additions & 7 deletions .github/workflows/refine-registry-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
- "packages/**"
branches:
- next
- releases/december-2024

env:
RELEASE_ONLY: ${{ secrets.RELEASE_ONLY }}

jobs:
publish:
Expand Down Expand Up @@ -37,31 +41,32 @@ jobs:
run: pnpm install
- name: Lint
run: pnpm lint:ci
if: ${{ env.RELEASE_ONLY != 'true' }}
if: ${{ env.RELEASE_ONLY != 'YES' }}
- name: Syncpack
run: pnpm sp lint
if: ${{ env.RELEASE_ONLY != 'true' }}
if: ${{ env.RELEASE_ONLY != 'YES' }}
- name: Publint
run: pnpm publint:all
if: ${{ env.RELEASE_ONLY != 'true' }}
if: ${{ env.RELEASE_ONLY != 'YES' }}
- name: Are The Types Wrong
run: pnpm attw:all
if: ${{ env.RELEASE_ONLY != 'true' }}
if: ${{ env.RELEASE_ONLY != 'YES' }}
- name: Test
run: pnpm test:all
if: ${{ env.RELEASE_ONLY != 'true' }}
if: ${{ env.RELEASE_ONLY != 'YES' }}
- name: Copy changesets for Community version
run: mkdir -p ./_changeset/ && cp -r ./.changeset/* ./_changeset/
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
version: pnpm version-packages
publish: pnpm changeset publish --tag next
publish: pnpm changeset publish
commit: "ci(changesets): refine registry version packages"
title: "ci(changesets): refine registry version packages"
createGithubReleases: false
env:
GITHUB_TOKEN: ${{ secrets.PANKOD_BOT_TOKEN }}
NPM_TOKEN: ${{ secrets.REFINE_REGISTRY_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.REFINE_REGISTRY_TOKEN }}
REFINE_RELEASE_TYPE: enterprise
19 changes: 18 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ jobs:
- name: Test
run: pnpm test:all
if: ${{ env.RELEASE_ONLY != 'true' }}
- name: Prepare Community Edition version changesets
if: "!contains(github.event.head_commit.message, 'ci(changesets): version packages')"
run: |
cp -R ./_changeset/* ./.changeset || : && rm -rf ./_changeset/
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
Expand All @@ -64,4 +68,17 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.PANKOD_BOT_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
REFINE_RELEASE_TYPE: community
- name: Merge main to next
env:
GITHUB_TOKEN: ${{ secrets.PANKOD_BOT_TOKEN }}
GIT_USER_EMAIL: [email protected]
GIT_USER_NAME: Refine Community Bot
if: steps.changesets.outputs.published == 'true'
run: |
git config --global user.email "${{ env.GIT_USER_EMAIL }}"
git config --global user.name "${{ env.GIT_USER_NAME }}"
git checkout next
git merge main
git push origin next

0 comments on commit 499c561

Please sign in to comment.