Skip to content

Commit 465fd59

Browse files
committed
add publish github action
1 parent 5fdabe6 commit 465fd59

File tree

3 files changed

+55
-5
lines changed

3 files changed

+55
-5
lines changed

.github/workflows/publish.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: publish
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ci_status:
7+
description: 'required CI status'
8+
default: 'success'
9+
required: true
10+
11+
jobs:
12+
publish:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: 'check successful status'
16+
run: |
17+
REF_STATUS=$(curl -s \
18+
'https://api.github.com/repos/${{ github.repository }}/commits/${{ github.ref }}/status' \
19+
| jq .state)
20+
[[ "${REF_STATUS}" == '"${{ github.event.inputs.ci_status }}"' ]] || \
21+
(echo "::error ::${{ github.ref }} does not have a successful CI status" && false)
22+
- uses: actions/checkout@v2
23+
with:
24+
ref: 'development'
25+
fetch-depth: 0
26+
- uses: actions/setup-node@v1
27+
- uses: actions/setup-python@v2
28+
with:
29+
node-version: 10
30+
- name: 'configure git'
31+
run: |
32+
git config --global user.email "github-actions@github.com"
33+
git config --global user.name "Github Actions"
34+
- name: 'install dependencies'
35+
run: |
36+
yarn -D
37+
- name: 'build and publish'
38+
run: |
39+
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
40+
npm run run:publish:gha
41+
env:
42+
NPM_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
43+
GITHUB_TOKEN: ${{ github.token }}
44+
- name: 'merge into main branch'
45+
run: |
46+
git checkout main && \
47+
git merge ${{ github.ref }} && \
48+
git push

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@
2020
"test:publish:circleci": "yarn npm-cli-login -u test -p test -e test@example.com -r http://localhost:4873 && IS_LOCAL_PUBLISH=true run-s script:publish test:installation:local",
2121
"run:publish": "run-s install:all script:prepublish_checks rebuild script:publish",
2222
"run:publish:local": "IS_LOCAL_PUBLISH=true yarn run:publish",
23+
"run:publish:gha": "run-s install:all rebuild script:publish:gha",
2324
"script:prepublish_checks": "node ./node_modules/@0x/monorepo-scripts/lib/prepublish_checks.js",
2425
"script:publish": "node ./node_modules/@0x/monorepo-scripts/lib/publish.js --repo protocol",
26+
"script:publish:gha": "node ./node_modules/@0x/monorepo-scripts/lib/publish.js --repo tools --auto-commit --no-upload-docs --yes",
2527
"install:all": "yarn install",
2628
"wsrun": "wsrun",
2729
"lerna": "lerna",
@@ -64,7 +66,7 @@
6466
"ignoreDependencyVersionsForPackage": "contract-wrappers"
6567
},
6668
"devDependencies": {
67-
"@0x/monorepo-scripts": "^2.0.3",
69+
"@0x/monorepo-scripts": "^2.0.4",
6870
"@0x-lerna-fork/lerna": "3.16.10",
6971
"@0xproject/npm-cli-login": "^0.0.11",
7072
"async-child-process": "^1.1.1",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -912,10 +912,10 @@
912912
web3-providers "^2.0.0-alpha.1"
913913
websocket "^1.0.29"
914914

915-
"@0x/monorepo-scripts@^2.0.3":
916-
version "2.0.3"
917-
resolved "https://registry.yarnpkg.com/@0x/monorepo-scripts/-/monorepo-scripts-2.0.3.tgz#4766b31329e9323eceb34abedbcff4113ffeb2d1"
918-
integrity sha512-jqycycIFZb+5g1Am9sOCHojXpqHx+7RPzjx3d4X/X0rQ6C/kct9dcSnWcMxStb9G411BcKjSpkTuW3c1FQeGIg==
915+
"@0x/monorepo-scripts@^2.0.4":
916+
version "2.0.4"
917+
resolved "https://registry.yarnpkg.com/@0x/monorepo-scripts/-/monorepo-scripts-2.0.4.tgz#26e5d868197e371408a400b22768ef7840d83c0c"
918+
integrity sha512-swxC+UZFdAKgcCrVpWmgydLNJXdOdTE5g6kiGIsiHMWBxIfAVjbXnHCpri6VYX16Jk2iu04F3STFJ0QlhfQmCA==
919919
dependencies:
920920
"@0x/types" "^3.2.4"
921921
"@0x/utils" "^5.6.3"

0 commit comments

Comments
 (0)