Skip to content

Commit

Permalink
ci to publish
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Oct 14, 2021
1 parent c98ae21 commit 0640c56
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 1 deletion.
64 changes: 64 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Release Pipeline (develop/2.0)

on:
pull_request:
branches:
- master
types:
- labeled
check_suite:
types:
- completed

jobs:
merge-release-branch:
# only run if prechecks pass and the source branch is named 'prerelease/*'
if: ${{ startsWith(github.head_ref, 'prerelease/2') }} && ${{ github.event.label.name == 'automerge' }}
runs-on: ubuntu-latest
steps:
- name: Automerge
uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MERGE_LABELS: automerge
MERGE_METHOD: squash
release-to-github:
needs:
- merge-release-branch
# release to github only when its a prerelease branch and auto merge label is triggered
if: ${{ startsWith(github.head_ref, 'prerelease/2') }} && ${{ github.event.label.name == 'automerge' }}
runs-on: ubuntu-latest
steps:
# checkout merged branch
- uses: actions/checkout@v2
with:
ref: master
- uses: actions/setup-node@v1
with:
node-version: '15.3'
- name: find release version
id: find_version
run: |
echo ::set-output name=tag_name::$(cat packages/api/package.json \
| grep version \
| head -1 \
| grep -E -o '[0-9|.]+\-*[a-z]*\.[0-9]+|]+')
- name: make release branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: "release/${{steps.find_version.outputs.tag_name}}"
- name: package
run: |
yarn && yarn build
npx lerna exec -- 'cp package.json build/'
npx lerna exec -- 'cp README.md build/'
npx lerna exec -- 'cp ../../LICENSE build/'
- name: publish to npm
env:
NPM_KEY: ${{ secrets.NPM_KEY }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_KEY}" > ~/.npmrc
echo 'Publishing to npmjs.org.'
npx lerna exec -- 'cd build && npm publish --access public'
4 changes: 3 additions & 1 deletion packages/extension-dapp/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ let web3EnablePromise: Promise<InjectedExtension[]> | null = null;

export { isWeb3Injected, web3EnablePromise };

const CENNZNET_EXT = "cennznet-extension";

function getWindowExtensions (originName: string): Promise<[InjectedExtensionInfo, Injected | void][]> {
if (win.injectedWeb3["cennznet-extension"]) {
return Promise.all(
Object.entries([win.injectedWeb3["cennznet-extension"]]).map(([name, {enable, version}]): Promise<[InjectedExtensionInfo, Injected | void]> =>
Object.entries([win.injectedWeb3[CENNZNET_EXT]]).map(([name, {enable, version}]): Promise<[InjectedExtensionInfo, Injected | void]> =>
Promise.all([
Promise.resolve({name, version}),
enable(originName).catch((error: Error): void => {
Expand Down

0 comments on commit 0640c56

Please sign in to comment.