From 19b217b20845f737f7aa8ee87e002f4ec78a7be7 Mon Sep 17 00:00:00 2001 From: Matatjahu Date: Tue, 20 Apr 2021 10:46:25 +0200 Subject: [PATCH] ci: add bump workflow --- .github/workflows/bump.yaml | 32 ++++++++++++++++++++++++++++++++ library/package.json | 4 +++- package.json | 4 +++- 3 files changed, 38 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/bump.yaml diff --git a/.github/workflows/bump.yaml b/.github/workflows/bump.yaml new file mode 100644 index 000000000..5d7dc61fd --- /dev/null +++ b/.github/workflows/bump.yaml @@ -0,0 +1,32 @@ +name: Bump package version in dependent repos + +on: + #It cannot run on release event as when release is created then version is not yet bumped in package.json + #This means we cannot extract easily latest version and have a risk that package is not yet on npm + push: + branches: + - master + +jobs: + bump: + runs-on: ubuntu-latest + steps: + - name: Checkout repo + uses: actions/checkout@v2 + - name: Get version from package.json before release step + id: extractver + run: echo "::set-output name=version::$(npm run get:version --silent)" + - name: Get name of package from package.json + id: extractname + run: echo "::set-output name=packname::$(npm run get:name --silent)" + - if: startsWith(github.event.commits[0].message, 'chore(release):') + name: Bumping latest version of this package in other repositories + uses: derberg/org-projects-dependency-manager@v1 + with: + github_token: ${{ secrets.GH_TOKEN }} + committer_username: asyncapi-bot + committer_email: info@asyncapi.io + #This is commit message and PR title for repos where this package is in dependencies + commit_message_prod: 'fix: update ${{ steps.extractname.outputs.packname }} to ${{ steps.extractver.outputs.version }} version' + #This is commit message and PR title for repos where this package is in devDependencies + commit_message_dev: 'chore: update ${{ steps.extractname.outputs.packname }} to ${{ steps.extractver.outputs.version }} version' diff --git a/library/package.json b/library/package.json index 88c53fa97..913cd6572 100644 --- a/library/package.json +++ b/library/package.json @@ -54,7 +54,9 @@ "test:watch": "jest --detectOpenHandles --watch", "prepare": "npm run build:prod", "prepack": "cp ../README.md ./README.md && cp ../LICENSE ./LICENSE", - "postpack": "rm -rf ./README.md && rm -rf ./LICENSE" + "postpack": "rm -rf ./README.md && rm -rf ./LICENSE", + "get:name": "echo $npm_package_name", + "get:version": "echo $npm_package_version" }, "dependencies": { "@asyncapi/avro-schema-parser": "^0.2.0", diff --git a/package.json b/package.json index 76fceb56a..2435849ee 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,9 @@ "bump:lib:version": "cd library && npm --no-git-tag-version --allow-same-version version $VERSION", "bump:version": "npm run bump:lib:version && npm run bump:webcomp:version && npm run bump:playground:version && npm run install:reactcomp:webcomponent && npm run install:reactcomp:playground", "install:reactcomp:playground": "cd playground && npm run install:reactcomp", - "install:reactcomp:webcomponent": "cd web-component && npm run install:reactcomp" + "install:reactcomp:webcomponent": "cd web-component && npm run install:reactcomp", + "get:name": "cd library && npm run get:name", + "get:version": "cd library && npm run get:version" }, "devDependencies": { "@semantic-release/commit-analyzer": "^8.0.1",