Skip to content

Commit

Permalink
Add scripts to prepare releases automatically (#3805)
Browse files Browse the repository at this point in the history
  • Loading branch information
dyladan authored May 17, 2023
1 parent fcd75df commit d4a41bd
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/label-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on:
pull_request_target:
branches:
- main

jobs:
label-release:
if: ${{ startsWith(github.event.pull_request.title, 'release:') }}
runs-on: ubuntu-latest
steps:
- run: echo this is a release PR
- run: gh pr edit ${{ github.event.pull_request.number }} --add-label release
20 changes: 18 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,24 @@
"lint:markdown": "./node_modules/.bin/markdownlint $(git ls-files '*.md') -i ./CHANGELOG.md",
"lint:markdown:fix": "./node_modules/.bin/markdownlint $(git ls-files '*.md') -i ./CHANGELOG.md --fix",
"reset": "lerna clean -y && rm -rf node_modules && npm i && npm run compile && npm run lint:fix",
"update-ts-configs": "node scripts/update-ts-configs.js"
"update-ts-configs": "node scripts/update-ts-configs.js",

"comment_prepare_1": "echo scripts in this section automatically prepare releases. Intended for use by maintainers only.",
"comment_prepare_2": "echo experimental preparation scripts only prepare experimental packages",
"prepare_release:experimental:patch": "npm run _check:no_changes && npm run _backup:lerna && npm run _lerna:remove_api && npm run _lerna:remove_stable && npm run _lerna:version_patch && npm run _restore:lerna",
"prepare_release:experimental:minor": "npm run _check:no_changes && npm run _backup:lerna && npm run _lerna:remove_api && npm run _lerna:remove_stable && npm run _lerna:version_minor && npm run _restore:lerna",
"comment_prepare_3": "echo sdk preparation scripts prepare all stable and experimental packages",
"prepare_release:sdk:patch": "npm run _check:no_changes && npm run _backup:lerna && npm run _lerna:remove_api && npm run _lerna:version_patch && npm run _restore:lerna",
"prepare_release:sdk:minor": "npm run _check:no_changes && npm run _backup:lerna && npm run _lerna:remove_api && npm run _lerna:version_minor && npm run _restore:lerna",

"comment_internal": "echo scripts below this line are for internal use",
"_check:no_changes": "if [ ! -z \"$(git status -uall --porcelain)\" ]; then echo Please ensure all changes are committed; exit 1; fi",
"_backup:lerna": "cp lerna.json lerna.json.backup",
"_restore:lerna": "mv lerna.json.backup lerna.json",
"_lerna:remove_api": "node -e 'var fs=require(\"fs\");var l=require(\"./lerna.json\");l.packages=l.packages.filter(p=>p!==\"api\");fs.writeFileSync(\"lerna.json\",JSON.stringify(l,null,2))'",
"_lerna:remove_stable": "node -e 'var fs=require(\"fs\");var l=require(\"./lerna.json\");l.packages=l.packages.filter(p=>p!==\"packages/*\");fs.writeFileSync(\"lerna.json\",JSON.stringify(l,null,2))'",
"_lerna:version_patch": "npx lerna version patch --exact --no-git-tag-version --no-push --yes",
"_lerna:version_minor": "npx lerna version minor --exact --no-git-tag-version --no-push --yes"
},
"repository": "open-telemetry/opentelemetry-js",
"keywords": [
Expand All @@ -55,7 +72,6 @@
"eslint-plugin-prettier": "4.2.1",
"gh-pages": "5.0.0",
"lerna": "6.0.3",
"lerna-changelog": "2.2.0",
"linkinator": "4.0.3",
"markdownlint-cli": "0.32.2",
"prettier": "2.8.0",
Expand Down

0 comments on commit d4a41bd

Please sign in to comment.