Skip to content

Commit

Permalink
fix: properly tag web-component on npm (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
derberg authored Nov 17, 2020
1 parent b369853 commit 4af684f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,13 @@ jobs:
- name: Get version from package.json after release-library step
id: extractver
run: echo "::set-output name=version::$(npm run get-lib-version --silent)"
- name: Get version from web-component package.json
id: webcompver
run: echo "::set-output name=version::$(npm run get-web-version --silent)"

# Web-component
- name: Install latest version of library in the web-component # this will update package.json and a lock file for the web-component that will also be pushed to PR with next step
if: steps.initversion.outputs.version != steps.extractver.outputs.version
if: steps.webcompver.outputs.version != steps.extractver.outputs.version
# sleep for 30 seconds before using latest version in web-component, because sometimes NPM needs additional few seconds to `saves` package in registry
run: |
sleep 1m
Expand All @@ -57,13 +60,14 @@ jobs:
npm install @asyncapi/react-component@${{ steps.extractver.outputs.version }} --save --loglevel verbose
working-directory: ./web-component
- name: Build web-component
if: steps.webcompver.outputs.version != steps.extractver.outputs.version
run: npm run build-web-component
- name: Release web-component to NPM
if: steps.webcompver.outputs.version != steps.extractver.outputs.version
uses: JS-DevTools/npm-publish@v1
with:
token: ${{ secrets.NPM_TOKEN }}
package: ./web-component/package.json
tag: ${{ steps.extractver.outputs.version }}
access: public

# Playground
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"conflict-check": "tslint-config-prettier-check ./tslint.json",
"markdownlint": "markdownlint **/*.md",
"release": "semantic-release",
"get-lib-version": "cd library && npm run get-version"
"get-lib-version": "cd library && npm run get-version",
"get-web-version": "cd web-component && npm run get-version"
},
"devDependencies": {
"tslib": "^1.10.0",
Expand Down
3 changes: 2 additions & 1 deletion web-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
"bundle": "webpack",
"prepare": "npm run bundle",
"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-version": "echo $npm_package_version"
},
"dependencies": {
"@asyncapi/react-component": "^0.17.1",
Expand Down

0 comments on commit 4af684f

Please sign in to comment.