Skip to content

Commit

Permalink
feat: modify releases
Browse files Browse the repository at this point in the history
  • Loading branch information
pklatka committed Mar 25, 2024
1 parent bfbc473 commit e023289
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 323 deletions.
16 changes: 1 addition & 15 deletions .release-it.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
module.exports = {
plugins: {
'@release-it/conventional-changelog': {
ignoreRecommendedBump: true,
preset: {
name: 'angular',
},
},
},
git: {
push: true,
requireCommits: true,
Expand All @@ -17,12 +9,6 @@ module.exports = {
pushArgs: ['--follow-tags', '--force'],
},
github: {
release: true,
releaseName: '${name}@${version}',
},
hooks: {
'before:init': 'git checkout -B next && turbo build',
'after:release':
'gh pr create --body "Release new version of the library." -w && git checkout main',
release: false,
},
};
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"@commitlint/cli": "^19.1.0",
"@commitlint/config-conventional": "^19.1.0",
"@release-it/bumper": "^6.0.1",
"@release-it/conventional-changelog": "^8.0.1",
"@types/jest": "^29.5.12",
"@types/react": "^18.2.65",
"@types/react-native": "^0.73.0",
Expand All @@ -33,7 +32,7 @@
"prettier": "^3.2.5",
"react-native-builder-bob": "^0.23.2",
"release-it": "^17.1.1",
"turbo": "latest",
"turbo": "^1.12.5",
"typescript": "^5.3.3"
},
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion packages/navigation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"scripts": {
"build": "bob build && yarn link",
"clean": "rm -rf lib node_modules",
"release": "release-it --config ../../.release-it.js --only-version",
"release": "sh ../../scripts/release.sh",
"typescript": "tsc",
"lint": "eslint \"src/**/*.{js,ts,tsx}\""
},
Expand Down
2 changes: 1 addition & 1 deletion packages/turbo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"scripts": {
"build": "bob build && sh ./scripts/build.sh $npm_package_hotwiredTurbo_ios $npm_package_hotwiredTurbo_android && yarn link",
"clean": "rm -rf lib node_modules",
"release": "release-it --config ../../.release-it.js --only-version",
"release": "sh ../../scripts/release.sh",
"typescript": "tsc",
"lint": "eslint \"src/**/*.{js,ts,tsx}\""
},
Expand Down
29 changes: 29 additions & 0 deletions scripts/release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
PACKAGE_NAME=$(grep -m1 name package.json | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')
OLD_VERSION=$(grep -m1 version package.json | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')

# Create a new branch
git checkout -B next

# Build the library
turbo build

# Run release-it
release-it --config ../../.release-it.js --only-version

git checkout next

VERSION=$(grep -m1 version package.json | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')

echo "New version: $VERSION"

# Create release PR and merge it
gh pr create --title "Release $PACKAGE_NAME@$VERSION" --body "Release new version of the library."
PR_NUMBER=$(gh pr list | grep "$PACKAGE_NAME@$VERSION" | awk '{print $1}')
gh pr merge $PR_NUMBER --squash --delete-branch

# Create release
gh release create "$PACKAGE_NAME@$VERSION" --title "$PACKAGE_NAME@$VERSION" --generate-notes --notes-start-tag "$PACKAGE_NAME@$OLD_VERSION"

# Cleanup
git checkout .
git checkout main
Loading

0 comments on commit e023289

Please sign in to comment.