Skip to content

Commit

Permalink
feat: add refine registry release workflow (#6546)
Browse files Browse the repository at this point in the history
  • Loading branch information
BatuhanW authored Dec 4, 2024
1 parent 6af8cf9 commit 6038c7d
Show file tree
Hide file tree
Showing 4 changed files with 153 additions and 38 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/refine-registry-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Refine Registry Release

on:
push:
paths:
- ".changeset/**"
- "packages/**"
branches:
- next

jobs:
publish:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [18.x]

steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.PANKOD_BOT_TOKEN }}
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: 18
cache: "pnpm"
- name: Creating .npmrc
run: |
cat << EOF > "$HOME/.npmrc"
@refinedev:registry=https://registry.refine.dev
//registry.refine.dev/:_authToken=$NPM_TOKEN
EOF
env:
NPM_TOKEN: ${{ secrets.REFINE_REGISTRY_TOKEN }}
- name: Install Dependencies & Build
run: pnpm install
- name: Lint
run: pnpm lint:ci
if: ${{ env.RELEASE_ONLY != 'true' }}
- name: Syncpack
run: pnpm sp lint
if: ${{ env.RELEASE_ONLY != 'true' }}
- name: Publint
run: pnpm publint:all
if: ${{ env.RELEASE_ONLY != 'true' }}
- name: Are The Types Wrong
run: pnpm attw:all
if: ${{ env.RELEASE_ONLY != 'true' }}
- name: Test
run: pnpm test:all
if: ${{ env.RELEASE_ONLY != 'true' }}
- 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
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}}
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,10 @@
"node": ">=18",
"pnpm": ">=9"
},
"pnpm": {
"patchedDependencies": {
"@changesets/[email protected]": "patches/@[email protected]"
}
},
"nx": {}
}
38 changes: 38 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
diff --git a/dist/changesets-git.cjs.js b/dist/changesets-git.cjs.js
index 415542c09ff1a3dbfc3eef7ff52f9d592a3be334..45d2e19a09a09b9a8f30dbe61c14f6f7e8ec4bb0 100644
--- a/dist/changesets-git.cjs.js
+++ b/dist/changesets-git.cjs.js
@@ -87,7 +87,7 @@ async function getCommitsThatAddFiles(gitPaths, {
do {
// Fetch commit information for all paths we don't have yet
const commitInfos = await Promise.all(remaining.map(async gitPath => {
- const [commitSha, parentSha] = (await spawn__default["default"]("git", ["log", "--diff-filter=A", "--max-count=1", short ? "--pretty=format:%h:%p" : "--pretty=format:%H:%p", gitPath], {
+ const [commitSha, parentSha] = (await spawn__default["default"]("git", ["log", "--follow", "--diff-filter=A", "--max-count=1", short ? "--pretty=format:%h:%p" : "--pretty=format:%H:%p", gitPath], {
cwd
})).stdout.toString().split(":");
return {
diff --git a/dist/changesets-git.esm.js b/dist/changesets-git.esm.js
index 58f76fe0cb21c35fa600e83f20fbbd23ee7d0ba0..0d65008e8e3a3f99277949f13c0c96584c60401c 100644
--- a/dist/changesets-git.esm.js
+++ b/dist/changesets-git.esm.js
@@ -75,7 +75,7 @@ async function getCommitsThatAddFiles(gitPaths, {
do {
// Fetch commit information for all paths we don't have yet
const commitInfos = await Promise.all(remaining.map(async gitPath => {
- const [commitSha, parentSha] = (await spawn("git", ["log", "--diff-filter=A", "--max-count=1", short ? "--pretty=format:%h:%p" : "--pretty=format:%H:%p", gitPath], {
+ const [commitSha, parentSha] = (await spawn("git", ["log", "--follow", "--diff-filter=A", "--max-count=1", short ? "--pretty=format:%h:%p" : "--pretty=format:%H:%p", gitPath], {
cwd
})).stdout.toString().split(":");
return {
diff --git a/src/index.ts b/src/index.ts
index 7e3aee53439f3724886eacc2bb9ea8b9abc6b6cf..306ade4b8a56a9c1f0af9f87a94ac65447271ed1 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -80,6 +80,7 @@ export async function getCommitsThatAddFiles(
"git",
[
"log",
+ "--follow",
"--diff-filter=A",
"--max-count=1",
short ? "--pretty=format:%h:%p" : "--pretty=format:%H:%p",
81 changes: 43 additions & 38 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 6038c7d

Please sign in to comment.